0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【小ネタ】php artisan route:listをgrepで絞るだけの話

Last updated at Posted at 2025-08-09

投稿の経緯

先日、新人がphp artisan route:listを実行して、延々とスクロールしており、
「grep使えばいいよ」と伝えると、「これ神です…!」と感動していました。
それだけの話ですが、記事にしてみました。

コマンドと実行結果

例:apiを含むルートだけ表示

php artisan route:list | grep api
GET|HEAD  api/user .......... App\Http\Controllers\UserController@index
POST      api/login ......... App\Http\Controllers\AuthController@login
(他は表示されません)

api が含まれる行だけが表示されます。

例:特定コントローラを含むルートだけ表示

php artisan route:list | grep UserController
GET|HEAD  users ............. App\Http\Controllers\UserController@index
POST      users ............. App\Http\Controllers\UserController@store
(他は表示されません)

UserController が含まれる行だけが表示されます。


スクロールするより、パイプ(|)打った方が早いです。

新人の頃ってパイプ(|)使わないですよね…。
僕も初心者のころ使いどころがわからなかったな~と思い、記事にしてみました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?