Эй, там! Поскольку вы здесь, вас может заинтересовать моя книга «Advanced PHP Strings: Text analysis, generation and parsing via. Laravel», который охватывает синтаксический анализ текста, манипулирование строками, управление кодировками символов и многое другое.
Книга содержит более 700 страниц подробных рассуждений от помощников Ларавеля до написания парсера Корнишона и Клинка.
Команда route:list
может быть использована для отображения списка всех зарегистрированных маршрутов для приложения. Эта команда отобразит домен, метод, URI, имя, действие и промежуточное ПО для маршрутов, которые она включает в созданную таблицу.
В следующем примере демонстрируется использование команды без каких-либо параметров.Таблицу
php artisan route:list
It will generate a table similar to the following output (the exact table entries will depend on the registered routes).
маршрутов можно фильтровать с помощью различных параметров, определенных командой. В следующей таблице перечислены и описаны все параметры, поддерживаемые командой. Некоторые из опций поддерживают пользовательские фильтры, которые обозначаются отображаемым <TERM>
в параметрах именем. Замените <TERM>
значением для фильтрации при выполнении команды.
Option Name | Description | Default Value |
---|---|---|
--method=<TERM> |
Filters the routes by method. | None |
--name=<TERM> |
Filters the routes by name. | None |
--path=<TERM> |
Filters the routes by path (URI). | None |
--reverse |
Reverses the order the routes are displayed in the table. | None |
-r |
Reverses the order the routes are displayed in the table (shortcut to --reverse ). |
None |
--sort |
The column to sort by. Accepted values are host , method , uri , name, action or middleware . |
uri |
В следующих примерах демонстрируются эффекты различных вариантов.
Фильтрация маршрутов по имени.Этот
# Filter the route list by name.
php artisan route:list --name=account
After the above command has executed, a table will be generated that only contains routes that have account
in the name
column:
же процесс можно повторить для параметров --method
и --path
параметров:
# Filter the route list by URI.
php artisan route:list --path=account
# Filter the route list by method.
php artisan route:list --method=GET
The filters can be combined; results will be aggregated using "and" logic. The following command:
php artisan route:list --path=account --method=GET
can be interpreted as "find all routes that contain account
in the URI and contain GET
in the method."
В следующих примерах показано, как вызвать команду с различными другими параметрами:
# Filter the routes and display them in reverse order.
php artisan route:list --method=GET --reverse
# The following is equivalent to the previous example.
php artisan route:list --method=GET -r
# Filter the routes and sort `name` column.
php artisan route:list --method=GET --sort=name