Skip to content

Commit 53ed80d

Browse files
authored
Merge pull request #163 from dotkernel/route-list-table-and-filters
Route list table and filters
2 parents 5c1337d + ea4aca7 commit 53ed80d

1 file changed

Lines changed: 52 additions & 44 deletions

File tree

‎docs/book/v7/commands/display-available-endpoints.md‎

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Summary
44

5-
The `route:list` CLI command inspects the application's routes at runtime and prints every endpoint's request method, route name and path.
5+
The `route:list` CLI command inspects the application's routes at runtime and prints a numbered table of every endpoint's request method, route name and path.
66
Results can be filtered by name, path or method.
77

88
## Usage
@@ -14,51 +14,54 @@ php ./bin/cli.php route:list
1414
```
1515

1616
The command runs through all routes and extracts endpoint information in realtime.
17+
Rows are sorted by path, then by request method, and UUID route parameters are shown as `{id}` rather than the full regular expression they are declared with.
18+
The count in the table header reflects method/path pairs, so a path answering three methods contributes three rows.
19+
1720
The output should be similar to the following:
1821

1922
```text
20-
+-------------------- 37 Routes ------+-------------------------------------+
21-
| Request method | Route name | Route path |
22-
+----------------+-------------------------------------+-------------------------------------+
23-
| GET | app::view-index | / |
24-
| GET | admin::list-admin | /admin |
25-
| POST | admin::create-admin | /admin |
26-
| GET | admin::view-account | /admin/account |
27-
| PATCH | admin::update-account | /admin/account |
28-
| GET | admin::list-role | /admin/role |
29-
| GET | admin::view-role | /admin/role/{id} |
30-
| DELETE | admin::delete-admin | /admin/{id} |
31-
| GET | admin::view-admin | /admin/{id} |
32-
| PATCH | admin::update-admin | /admin/{id} |
33-
| POST | app::create-error-report | /error-report |
34-
| POST | security::token | /security/token |
35-
| GET | user::list-user | /user |
36-
| POST | user::create-user | /user |
37-
| DELETE | user::delete-account | /user/account |
38-
| GET | user::view-account | /user/account |
39-
| PATCH | user::update-account | /user/account |
40-
| POST | user::create-account | /user/account |
41-
| POST | user::request-activate-account | /user/account/activate |
42-
| PATCH | user::activate-account | /user/account/activate/{hash} |
43-
| DELETE | user::delete-account-avatar | /user/account/avatar |
44-
| GET | user::view-account-avatar | /user/account/avatar |
45-
| POST | user::create-account-avatar | /user/account/avatar |
46-
| POST | user::recover-account | /user/account/recover |
47-
| POST | user::create-account-reset-password | /user/account/reset-password |
48-
| GET | user::check-account-reset-password | /user/account/reset-password/{hash} |
49-
| PATCH | user::update-account-reset-password | /user/account/reset-password/{hash} |
50-
| GET | user::list-role | /user/role |
51-
| GET | user::view-role | /user/role/{id} |
52-
| DELETE | user::delete-user | /user/{id} |
53-
| GET | user::view-user | /user/{id} |
54-
| PATCH | user::update-user | /user/{id} |
55-
| PATCH | user::activate-user | /user/{id}/activate |
56-
| DELETE | user::delete-user-avatar | /user/{id}/avatar |
57-
| GET | user::view-user-avatar | /user/{id}/avatar |
58-
| POST | user::create-user-avatar | /user/{id}/avatar |
59-
| PATCH | user::deactivate-user | /user/{id}/deactivate |
23+
+------+----------------+-------------------- 38 Routes ------+-------------------------------------+
24+
| # | Request method | Route name | Route path |
25+
+------+----------------+-------------------------------------+-------------------------------------+
26+
| 1 | GET | app::view-index | / |
27+
| 2 | GET | admin::list-admin | /admin |
28+
| 3 | POST | admin::create-admin | /admin |
29+
| 4 | GET | admin::view-account | /admin/account |
30+
| 5 | PATCH | admin::update-account | /admin/account |
31+
| 6 | GET | admin::list-role | /admin/role |
32+
| 7 | GET | admin::view-role | /admin/role/{id} |
33+
| 8 | DELETE | admin::delete-admin | /admin/{id} |
34+
| 9 | GET | admin::view-admin | /admin/{id} |
35+
| 10 | PATCH | admin::update-admin | /admin/{id} |
36+
| 11 | POST | app::create-error-report | /error-report |
37+
| 12 | POST | security::generate-token | /security/generate-token |
38+
| 13 | POST | security::refresh-token | /security/refresh-token |
39+
| 14 | GET | user::list-user | /user |
40+
| 15 | POST | user::create-user | /user |
41+
| 16 | DELETE | user::delete-account | /user/account |
42+
| 17 | GET | user::view-account | /user/account |
43+
| 18 | PATCH | user::update-account | /user/account |
44+
| 19 | POST | user::create-account | /user/account |
45+
| 20 | POST | user::request-activate-account | /user/account/activate |
46+
| 21 | PATCH | user::activate-account | /user/account/activate/{hash} |
47+
| 22 | DELETE | user::delete-account-avatar | /user/account/avatar |
48+
| 23 | GET | user::view-account-avatar | /user/account/avatar |
49+
| 24 | POST | user::create-account-avatar | /user/account/avatar |
50+
| 25 | POST | user::recover-account | /user/account/recover |
51+
| 26 | POST | user::create-account-reset-password | /user/account/reset-password |
52+
| 27 | GET | user::check-account-reset-password | /user/account/reset-password/{hash} |
53+
| 28 | PATCH | user::update-account-reset-password | /user/account/reset-password/{hash} |
54+
| 29 | GET | user::list-role | /user/role |
55+
| 30 | GET | user::view-role | /user/role/{id} |
56+
| 31 | DELETE | user::delete-user | /user/{id} |
57+
| 32 | GET | user::view-user | /user/{id} |
58+
| 33 | PATCH | user::update-user | /user/{id} |
59+
| 34 | PATCH | user::activate-user | /user/{id}/activate |
60+
| 35 | DELETE | user::delete-user-avatar | /user/{id}/avatar |
61+
| 36 | GET | user::view-user-avatar | /user/{id}/avatar |
62+
| 37 | POST | user::create-user-avatar | /user/{id}/avatar |
63+
| 38 | PATCH | user::deactivate-user | /user/{id}/deactivate |
6064
+------+----------------+-------------------------------------+-------------------------------------+
61-
6265
```
6366

6467
## Filtering results
@@ -69,7 +72,11 @@ The following filters can be applied when displaying the route list:
6972
* Filter routes by path, using: `-p|--path[=PATH]`
7073
* Filter routes by method, using: `-m|--method[=METHOD]`
7174

72-
The filters are case-insensitive and can be combined.
75+
The filters are matched as case-sensitive substrings and can be combined.
76+
For example, `php ./bin/cli.php route:list -i avatar` lists only the six avatar routes, and adding `-m GET` narrows that to two.
77+
78+
> Case matters.
79+
> Route names and paths are lowercase and methods are uppercase, so `-i avatar` and `-m GET` match, while `-i Avatar` and `-m get` match nothing and print an empty table.
7380
7481
Get more help by running this command:
7582

@@ -86,7 +93,8 @@ A: No. The command walks the application's registered routes in realtime, so it
8693
**Q: Which filters are available?**
8794

8895
A: `-i|--name`, `-p|--path` and `-m|--method`.
89-
They are case-insensitive and can be combined.
96+
Each is a case-sensitive substring match, and they can be combined.
97+
Use lowercase for names and paths and uppercase for methods — `-m get` matches nothing.
9098

9199
**Q: Why do route names matter beyond documentation?**
92100

0 commit comments

Comments
 (0)