• Время чтения ~1 мин
  • 08.04.2023
 
 

Эй, там! Поскольку вы здесь, вас может заинтересовать моя книга «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).

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:

Filtered routes

же процесс можно повторить для параметров --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

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

Про мене

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

Об авторе CrazyBoy49z
WORK EXPERIENCE
Контакты
Ukraine, Lutsk
+380979856297