November 26th, 2021


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:

1composer require s-patompong/laravel-routes-html

You can publish the config file with:

1php artisan vendor:publish --tag="routes-html-config"

Publish the views using:

1php 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.

1return [
2 /**
3 * Either you want to enable or disable the route
4 * It should be enabled only in the local environment
5 * By default, it'll be enabled if the app.debug is true
6 */
7 'enabled' => (bool) env('ROUTES_HTML_ENABLED', config('app.debug')),
9 /**
10 * The route URI
11 */
12 'uri' => '/route-list',
14 /**
15 * The route name
16 */
17 'route_name' => 'routes',
19 /**
20 * The list of route to ignore
21 */
22 'ignore_routes' => [
23 'routes-html/*',
24 '_ignition/*',
25 'sanctum/*',
26 'livewire/*',
27 ],

This can come in handy when dealing with long and messy routes generated by the route:list command.

Github repo

Follow @LaravelMagazine on Twitter →
Marian Pop

I’m a Full-Stack Developer based in Transylvania. I use Laravel daily whether it’s for work or my personal projects.


Get latest news, tutorials, community articles and podcast episodes delivered to your inbox every Friday!

We'll never share your email address and you can opt out at any time.