Skip to content
Log what routes were used and when. Easily figure out if one hasn't been called in a long time (and delete it! πŸ₯³)
Branch: master
Clone or download
Latest commit 6bae6f9 Nov 4, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Edit readme and changelog Oct 28, 2019
resources/views Protect HTML page with Gate Oct 29, 2019
src Filter Route from usage:route command too Oct 29, 2019
tests Protect HTML page with Gate Oct 29, 2019
.editorconfig Boilerplate from Oct 15, 2019
.gitattributes Boilerplate from Oct 15, 2019
.gitignore Boilerplate from Oct 15, 2019
.php_cs fix style with php-cs-fixer Oct 20, 2019
.styleci.yml Boilerplate from Oct 15, 2019
.travis.yml Tidy up Travis config Nov 2, 2019 Edit Changelog Oct 29, 2019 Boilerplate from Oct 15, 2019 πŸ“• Edit README Oct 29, 2019
composer.json Update composer.json Oct 20, 2019
phpunit.xml.dist Protect HTML page with Gate Oct 29, 2019

Route Usage for Laravel

Latest Version on Packagist Build Status

This package keeps track of all requests to know what controller method, and when it was called. The goal is not to build some sort of analytics but to find out if there are unused endpoints or controller method.

After a few years, any projects have dead code and unused endpoint. Typically, you removed a link on your frontend, nothing ever links to that old /special-page. You want to remove it, but you're not sure. Have look at the route_usage table and figure out when this page was accessed for the last time. Last week? Better keep it for now. 3 years ago? REMOVE THE CODE! πŸ₯³

/route-usage screenshot

php artisan usage:route screenshot


You can install the package via composer:

composer require julienbourdeau/route-usage

Run migrations to create the new route_usage table.

php artisan migrate

Publish configuration

php artisan vendor:publish --provider="Julienbourdeau\RouteUsage\RouteUsageServiceProvider"


To access the route usage, you can do it in your terminal with the command.

php artisan usage:route

To access the HTML table, you'll first need to define who can access it. By default, it's available only on local environment.

In your AuthServiceProvide, in the boot method, define who can access this page:

Gate::define('viewRouteUsage', function ($user) {
    return $user->isSuperAdmin();

Then, head over to yourapp.tld/route-usage.



Here you may specify regex to exclude routes from being logged. Typically, you want may want to exclude routes from packages or dev controllers. The value must be a valid regex or anything falsy.


  • I only logs request with a 2xx or 3xx HTTP response. I don't think the rest makes sense. Your opinion is welcome!
  • In the very first version, I was incrementing a count attribute. I removed it because I think it gives a wrong information. If it was used a lot because but last access was a year ago, it gives a false sense of importance to this unused route.


  • Add option to put page behind middleware (like dev in Laravel Spark)
  • Add support for Redis to log updated_at



Please see CHANGELOG for more information what has changed recently.


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.


Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


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

You can’t perform that action at this time.