View your Laravel routes in your browser
Patompong Savaengsuk created a package that adds a route to your Laravel application. The route will render all your Laravel routes in a nice HTML format. It also has a minimal filter input that you can use to filter by route URI or route Name.
You can install the package via composer:
composer require s-patompong/laravel-routes-html
You can publish the config file with:
php artisan vendor:publish --tag="routes-html-config"
Publish the views using:
php artisan vendor:publish --tag="routes-html-views"
In the config file, you can configure when to make the /route-list endpoint available. By default they views are only available when APP_DEBUG is true.
return [
/**
* Either you want to enable or disable the route
* It should be enabled only in the local environment
* By default, it'll be enabled if the app.debug is true
*/
'enabled' => (bool) env('ROUTES_HTML_ENABLED', config('app.debug')),
/**
* The route URI
*/
'uri' => '/route-list',
/**
* The route name
*/
'route_name' => 'routes',
/**
* The list of route to ignore
*/
'ignore_routes' => [
'routes-html/*',
'_ignition/*',
'sanctum/*',
'livewire/*',
],
];
This can come in handy when dealing with long and messy routes generated by the route:list command.