-
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
[9.x] Reinvents route:list
command
#40269
Conversation
@nunomaduro this is really nice work. Two suggestions, if I may?
|
Came here to suggest the same. Name is paramount. |
@nunomaduro let's try adding the name to the default view. |
@taylorotwell done. |
@nunomaduro might look less cluttered aligned beside the endpoint. GET | HEAD users/{user}/followers followers.index.................FollowerController@index Personally.. I think If i want to "know more" or see "meta" info.. I add -v I get it |
I agree with one of the comments above that http verbs could be shortened to a single letter by default (maybe leave them expanded when using the verbose flag). There are only a few of them and they all have a different first letter.
With the color codes it looks readable enough. And verbose mode gives you full info. |
Absolutely love this! I'm not convinced that single letter verbs is the way forward though, considering that |
Could be shortened to a 3 letter code to differentiate put/post/patch. Just
noting here that the `|head` part is considerably pushing the whole to the
right.
|
Hey! I created https://github.com/morrislaptop/laravel-route-menu The one key feature I’d love added to this would be printing the file path in verbose mode. It’s great for an IDE terminal to jump to the relevant file. |
Well done man 👍 @morrislaptop |
Great work, improving het route:list output. For many projects, I use a customized version because the original version doesn't cut it. I really like the use of various colors to highlight things like parameters. I do see advantages of letting the fixed columns go and just let the text reach where-ever it needs to. However, I also like the So, here's my thought: would it be possible to make the output more customizable and include options from e.g. the
Also, some other thoughts:
|
@nunomaduro I suggest, how about adding additional params to filter the list. Like, And arguments like |
this looks more pleasing to the eye, can this also be applied to previous versions ? |
@adjarriawan no, this PR contains breaking changes. |
A bit late to the party, but could the gray shade be improved so the contrast ratio is increased for better readability? Right now contrast ratio between the text color ( Although different OSes have different terminal background color, I tried with pure black, and ratio is 4.36:1. WCAG 2.1 recommends a minimum contrast ratio of 4.5:1 for text: https://www.w3.org/TR/WCAG21/#contrast-minimum More info can be found here: https://webaim.org/articles/contrast/ Although it could seem as being a nitty-picky request, I personally had difficulties reading the grayed out text on the screenshot samples. Maybe are my eyes showing their age. A text color of For instance, I came up with that color by moving the lightness slider until it matched at least a 4.5:1 on all 3 background colors listed above. The tool used is Kontrast , but it is only available for Linux. Similar tools are easy to find over the web. Personally I would prefer a brighter shade of gray, such as But I understand it could make the aesthetics less appealing. The suggested shade already seems much better for my eyes. Thanks in advance for considering this. :) ping @nunomaduro |
Is there --ansi support for this? /cc @nunomaduro |
This pull request proposes a brand new
route:list
command - for Laravel 9 - regarding the way displays the application routes on the console.What problem does this pull request solves?
Well, it's known that on Laravel applications with a huge and complex list of routes, the existing
route:list
artisan command don't display the routes properly:Proposed changes
This pull request changes the way we display routes on the
route:list
artisan command, and essentially there are two modes: default and verbose.Default (non-verbose)
The default - non-verbose - is the mode we get when running:
php artisan route:list
, and it looks like this:Now, in this mode, the following information is displayed:
method
,domain@uri
, andaction
. In addition, we ensure that the console output is always pretty, even in small terminals:As you can see, the new display ensures we truncate the
action
at the end of the line, ensuring this way things are always properly displayed.Verbose
The verbose is the mode we get when using the option
-v
:php artisan route:list -v
, and it looks like this:Now, in this mode, the following information is displayed:
method
,domain@uri
,name
,action
, and list ofmiddleware
. In addition, we don't truncate any kind of information.As you can see, in this mode, we display the
name
just next to thedomain@uri
, and we display a list ofmiddleware
used by the route.Displayed actions are abbreviated
One more thing regarding this new
route:list
artisan command, is the way we display actions:In this example, you can see that
App\Http\Controllers\SearchController
got abbreviated toSearchController
andLaravel\Sanctum\Http\ControllersCsrfCookieController@show
got abbreviated toLaravel\Sanctum › CsrfCookieController@show
.Domains
Domains are displayed right before actions:
Finally, it's important to mention that all the options -
json
,sort
, etc - work just like in the past. Except for the optionscompact
andcolumns
that got removed.Also, this pull request it's originally inspired by https://github.com/Wulfheart/pretty-routes, but of course, the display and features at this point are a little bit different.
Edit 1: There is a breaking change, regarding the
Illuminate/Contracts/Routing/UrlGenerator
contract that needs to be documented on the upgrade guide, this pull request gets merged.Edit 2: After reading the community feedback, we decided to add the
name
just before the action.