lukasss93 / laravel-route-debug
Print the route name and action in the response headers.
Fund package maintenance!
Lukasss93
Installs: 3 099
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0
- illuminate/http: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
This package is auto-updated.
Last update: 2025-02-18 23:24:24 UTC
README
Laravel Route Debug
A simple package that prints the current route name and action in the Response Headers.
🚀 Installation
You can install the package using composer
composer require lukasss93/laravel-route-debug --dev
Then add the service provider to config/app.php
.
This step can be skipped if package auto-discovery is enabled.
'providers' => [ Lukasss93\Laravel\RouteDebug\RouteDebugServiceProvider::class, ];
⚙ Publishing the config file
Publishing the config file is optional:
php artisan vendor:publish --provider="Lukasss93\Laravel\RouteDebug\RouteDebugServiceProvider" --tag="route-debug-config"
👓 Usage
Enable the package turning on the APP_DEBUG
environment variable or by setting the enabled
config option to true
.
Then, when you visit a page, you will see the route debuggers in the response headers.
Route Debuggers
The package will add the following headers to the response:
Laravel-Route-Name
: The name of the current route.Laravel-Route-Action
: The action of the current route.Laravel-Route-Can
: The value of thecan
middleware of the current route.Laravel-Route-FormRequest
: The FormRequest class of the current route action.
You can disable any of these headers by commenting out the corresponding line in the config/route-debug.php
file.
Custom Route Debugger
You can create a custom route debugger to add your own headers to the response.
- Create a new class that implements the
Lukasss93\Laravel\RouteDebug\Contracts\RouteDebugger
interface. - Add your custom logic to the
handle
method. - Register your custom route debugger in the
config/route-debug.php
file under thedebuggers
key.
Screenshot
⚗️ Testing
composer test
🔰 Version Support
📃 Changelog
Please see the CHANGELOG.md for more information on what has changed recently.
🏅 Credits
📖 License
Please see the LICENSE.md file for more information.