Displaying DotKernel API endpoints using dot-cli

Starting from version 3, DotKernel API uses dot-cli to display a list of available endpoints.

Usage

Run the following command in your application’s root directory:

php ./bin/cli.php route:list

The command runs through all routes and extracts endpoint information in realtime. The output should be similar to the following:

+--------+---------------------------------+--------------------------------+
| Method | Name                            | Path                           |
+--------+---------------------------------+--------------------------------+
| PATCH  | account.activate                | /account/activate/{hash}       |
| POST   | account.activate.request        | /account/activate              |
| PATCH  | account.modify-password         | /account/reset-password/{hash} |
| POST   | account.recover-identity        | /account/recover-identity      |
| POST   | account.register                | /account/register              |
| POST   | account.reset-password.request  | /account/reset-password        |
| GET    | account.reset-password.validate | /account/reset-password/{hash} |
| POST   | admin.create                    | /admin                         |
| DELETE | admin.delete                    | /admin/{uuid}                  |
| GET    | admin.list                      | /admin                         |
| PATCH  | admin.my-account.update         | /admin/my-account              |
| GET    | admin.my-account.view           | /admin/my-account              |
| GET    | admin.role.list                 | /admin/role                    |
| GET    | admin.role.view                 | /admin/role/{uuid}             |
| PATCH  | admin.update                    | /admin/{uuid}                  |
| GET    | admin.view                      | /admin/{uuid}                  |
| POST   | error.report                    | /error-report                  |
| GET    | home                            | /                              |
| POST   | security.generate-token         | /security/generate-token       |
| POST   | security.refresh-token          | /security/refresh-token        |
| POST   | user.activate                   | /user/{uuid}/activate          |
| POST   | user.avatar.create              | /user/{uuid}/avatar            |
| DELETE | user.avatar.delete              | /user/{uuid}/avatar            |
| GET    | user.avatar.view                | /user/{uuid}/avatar            |
| POST   | user.create                     | /user                          |
| DELETE | user.delete                     | /user/{uuid}                   |
| GET    | user.list                       | /user                          |
| DELETE | user.my-account.delete          | /user/my-account               |
| PATCH  | user.my-account.update          | /user/my-account               |
| GET    | user.my-account.view            | /user/my-account               |
| POST   | user.my-avatar.create           | /user/my-avatar                |
| DELETE | user.my-avatar.delete           | /user/my-avatar                |
| GET    | user.my-avatar.view             | /user/my-avatar                |
| GET    | user.role.list                  | /user/role                     |
| GET    | user.role.view                  | /user/role/{uuid}              |
| PATCH  | user.update                     | /user/{uuid}                   |
| GET    | user.view                       | /user/{uuid}                   |
+--------+---------------------------------+--------------------------------+

Filtering results

The following filters can be applied when displaying the routes list:

  • Filter routes by name, using: -i|--name[=NAME]
  • Filter routes by path, using: -p|--path[=PATH]
  • Filter routes by method, using: -m|--method[=METHOD]

The filters are case-insensitive and can be combined.

Example

Let’s find which path should one call to register their user account. For this we will list routes where method is POST and name contains the string register:

php ./bin/cli.php route:list --method=post --name=register

The output is the following:

+--------+------------------+-------------------+
| Method | Name             | Path              |
+--------+------------------+-------------------+
| POST   | account.register | /account/register |
+--------+------------------+-------------------+

You can get more help with this command by running:

php ./bin/cli.php route:list --help

Looking for PHP, Laminas or Mezzio Support?

As part of the Laminas Commercial Vendor Program, Apidemia offers expert technical support and services for:

  • Modernising Legacy Applications
  • Migration from any version of Zend Framework to Laminas
  • Migration from legacy Laminas API Tools (formerly Apigility) to Dotkernel API
  • Mezzio and Laminas Consulting and Technical Audit
  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>