-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[10.x] Allow route:list to expand middleware groups in 'VeryVerbose' mode #48703
[10.x] Allow route:list to expand middleware groups in 'VeryVerbose' mode #48703
Conversation
Also prepared a docs addition, but will wait with the PR until we have a result here. |
Do you know if they are sorted properly into the actual order they will be executed in? For example the SortMiddleware class will rearrange your middleware to make sure certain things run before others. |
Yes, @taylorotwell, they are. I just added this to the 'Benefits' section of the description 2 minutes before you commented:
Command calls See:
framework/src/Illuminate/Routing/Router.php Line 809 in 1cae837
Edit: Example |
Added test |
…ddlewarePriority() works as well, and that middleware is not displayed in non very verbose cases
Thanks 👍 |
Lovely addition, @NickSdot. Thanks for making this happen! |
Thanks for ping-ponging the idea with me @timacdonald 🙏 |
* Add docs for expandable middleware group via `php artisan route:list -vv` (laravel/framework#48703) * Improve wording * Formatting * Wording * Update routing.md --------- Co-authored-by: Taylor Otwell <[email protected]>
…mode (laravel#48703) * Allow middleware groups to be expanded with -vv * Keep things simple and do not use group nesting * Moved test to correct folder * Removed useless tmp vars * Style Changes * Added test to ensure expanded middleware are correctly sorted * Improved tests once again to ensure ordering via $kernel->prependToMiddlewarePriority() works as well, and that middleware is not displayed in non very verbose cases
Together with @timacdonald I've been exploring the idea of expanding the middleware groups when using
route:list
. We both feel that being able to see the actual middleware being used instead of group names like 'web' adds value to the command. This PR proposes this as optional functionality.Benefits
Developers see what really is applied, instead of group names. No more jumping to e.g. the Kernel, to see what is in the group. Most importantly, the middleware are listed in the order defined by
$middlewarePriority
.When merged
route:list
(no change)route:list -v
(no change)route:list -vv
(expands middleware groups)The group name
web
is no longer listed. Instead, the actual middleware from that group are listed. The same behaviour applies when using the--json
flag.Consideration
The
-vv
flag until now has not been used in the command. If someone were to use it in an automated way for whatever reason, this change could be considered a BC break.However, I wanted to get the maintainer's opinion on this first.
If you consider it a BC break, there are two options:
A) Target Laravel 11
B) Add a new flag
--expand-groups
/-e
.Input welcome.