Skip to content

s-patompong/laravel-routes-html

Repository files navigation

View your Laravel routes on the browser 🏖

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package adds a route to your Laravel application. Once you've installed this package, enter /route-list path in the browser to see your route list.

laravel-routes-html.mov

Features

  • See all routes in your Laravel application in a nicely formatted table with responsive layout.
  • Sort routes by domain, method, uri, name, action, and middleware.
  • Quickly filter to see only the routes that you want. 🎉
  • Click on the GET|HEAD route to open it on a new tab. You need to specify the parameters if the route requires them. 😎

Installation

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"

Optionally, you can publish the views using

php artisan vendor:publish --tag="routes-html-views"

This is the contents of the published config file:

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' => [
        '_ignition/*',
        'sanctum/*',
        'livewire/*',
    ],
    
    /**
     * The list of middleware that you want
     * the request to run through before hitting
     * the /route-list route
     */
    'middlewares' => [
        // Example: uncomment the first line below
        // to allow only the authenticated user
        // to use the /route-list route

        // \App\Http\Middleware\Authenticate::class
    ],
];

Usage

Open your Laravel application on the browser and go to /route-list URL (or the URL that you put inside the routes-html.uri).

Screenshot

Route Middlewares

To add middlewares to the request pipeline before it hits the /route-list route. Add the middleware classname to the middlewares key in the config file like so:

'middlewares' => [
    \App\Http\Middleware\Authenticate::class
]

This will make sure that only the authenticated user can access the /route-list route.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.