Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Feb 28, 2022
Merged

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

merged 4 commits into from
Feb 28, 2022

Conversation

amiranagram
Copy link
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
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
Member

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

@amiranagram
Copy link
Contributor Author

Agree @nunomaduro, open to suggestions.

@dammy001
Copy link
Contributor

dammy001 commented Feb 25, 2022

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

@nunomaduro
Copy link
Member

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

@amiranagram
Copy link
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