Skip to content

[9.x] Add option to filter out routes defined in vendor packages in route:list command#41254

Merged
taylorotwell merged 4 commits intolaravel:9.xfrom
amiranagram:route-list-command-filter-out-vendor-routes
Feb 28, 2022
Merged

[9.x] Add option to filter out routes defined in vendor packages in route:list command#41254
taylorotwell merged 4 commits intolaravel:9.xfrom
amiranagram:route-list-command-filter-out-vendor-routes

Conversation

@amiranagram
Copy link
Copy Markdown
Contributor

This PR adds the ability for route:list command to filter out routes defined in vendor (third-party) packages.

php artisan route:list --except-vendor

IMHO, very useful option in projects that have tons of registered routes via third-party packages (Horizon, Nova, Debugbar, etc.).

Tests are missing because I can't figure out a way to mock routes so they show another path other than where I defined them (in the test class). So maybe someone can help me out.

Also let me know if --except-vendor is not a good option name for the command.

Cheers.

@amiranagram
Copy link
Copy Markdown
Contributor Author

P.S. Would mocking the whole RouteListCommand class be a good way to modify the desired behavior so I can add some tests?

@nunomaduro
Copy link
Copy Markdown
Member

I like this feature - just not sure about the --except-vendor naming. Lets see what Taylor thinks.

@amiranagram
Copy link
Copy Markdown
Contributor Author

Agree @nunomaduro, open to suggestions.

@dammy001
Copy link
Copy Markdown
Contributor

dammy001 commented Feb 25, 2022

@amiranagram how about --ignore-vendor or --skip-vendor

@nunomaduro
Copy link
Copy Markdown
Member

Nevermind. Agree that --except-vendor is the best naming.

@amiranagram
Copy link
Copy Markdown
Contributor Author

amiranagram commented Feb 25, 2022

Alright. What do you think about tests? @nunomaduro

Tests are missing because I can't figure out a way to mock routes so they show another path other than where I defined them (in the test class). So maybe someone can help me out.

P.S. Would mocking the whole RouteListCommand class be a good way to modify the desired behavior so I can add some tests?

@taylorotwell taylorotwell merged commit aa2853e into laravel:9.x Feb 28, 2022
@amiranagram amiranagram deleted the route-list-command-filter-out-vendor-routes branch March 3, 2022 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants