PHPackages                             julienbourdeau/route-usage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. julienbourdeau/route-usage

ActiveLibrary

julienbourdeau/route-usage
==========================

Log what routes were used and when. Easily figure out if one hasn't been called in a long time (and delete it! 🥳)

0.5(4y ago)27658.8k—4.1%16[3 issues](https://github.com/julienbourdeau/route-usage/issues)MITPHPPHP &gt;= 7.1CI failing

Since Oct 20Pushed 4y ago3 watchersCompare

[ Source](https://github.com/julienbourdeau/route-usage)[ Packagist](https://packagist.org/packages/julienbourdeau/route-usage)[ Docs](https://github.com/julienbourdeau/route-usage)[ RSS](/packages/julienbourdeau-route-usage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (7)Used By (0)

Route Usage for Laravel
=======================

[](#route-usage-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c03a3868a4779bcac7ed69534fc233aa18b46c51d9f8b45595456da13484fdff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a756c69656e626f7572646561752f726f7574652d75736167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/julienbourdeau/route-usage)[![Build Status](https://camo.githubusercontent.com/89df68af21eb376e96a2957afa363711eccdd0a68650b67aaaeeed9753ec5b2e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a756c69656e626f7572646561752f726f7574652d75736167652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/julienbourdeau/route-usage)

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](https://user-images.githubusercontent.com/10015302/67657430-b1cbac00-f991-11e9-92f9-4954d762086f.png)](https://user-images.githubusercontent.com/10015302/67657430-b1cbac00-f991-11e9-92f9-4954d762086f.png)

[![php artisan usage:route screenshot](https://user-images.githubusercontent.com/1525636/67163336-f9d54800-f36d-11e9-9e23-41bd7f06ca4d.png)](https://user-images.githubusercontent.com/1525636/67163336-f9d54800-f36d-11e9-9e23-41bd7f06ca4d.png)

Installation
------------

[](#installation)

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"
```

Usage
-----

[](#usage)

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`.

Configuration
-------------

[](#configuration)

### excluding-regex

[](#excluding-regex)

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.

Notes
-----

[](#notes)

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

Road to 1.0 release
-------------------

[](#road-to-10-release)

**Less SQL queries**

I'll like to reduce the number of SQL queries performed. Typically, if a route is called, we don't need to log usage for the next 5 minutes. I'm thinking we could use some cache or split the data: attributes in mysql but last used date in Redis.

💡 Feel free to open an issue to discuss your ideas.

**More package to ignore**

Today, we ignore routes from Nova or Debugbar because there is nothing you can do about these routes. I'd like to support more packages out of the box.

📦 What package would you like to see added?

About
-----

[](#about)

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

### Contributing

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

### Credits

[](#credits)

- [Julien Bourdeau](https://github.com/julienbourdeau)
- [All Contributors](../../contributors)

### Laravel Package Boilerplate

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~127 days

Recently: every ~157 days

Total

6

Last Release

1766d ago

PHP version history (2 changes)0.1PHP ^7.1

0.5PHP &gt;= 7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd7b3a0ca4d58fca8b57cfd28ac17cb1e37b5fc6f92376b725a9d22f3d94379e?d=identicon)[julienbourdeau](/maintainers/julienbourdeau)

---

Top Contributors

[![julienbourdeau](https://avatars.githubusercontent.com/u/1525636?v=4)](https://github.com/julienbourdeau "julienbourdeau (30 commits)")[![rogervila](https://avatars.githubusercontent.com/u/6053012?v=4)](https://github.com/rogervila "rogervila (8 commits)")[![harlekoy](https://avatars.githubusercontent.com/u/10015302?v=4)](https://github.com/harlekoy "harlekoy (1 commits)")[![ingalless](https://avatars.githubusercontent.com/u/22981941?v=4)](https://github.com/ingalless "ingalless (1 commits)")[![SjorsO](https://avatars.githubusercontent.com/u/7202674?v=4)](https://github.com/SjorsO "SjorsO (1 commits)")[![fgilio](https://avatars.githubusercontent.com/u/6857732?v=4)](https://github.com/fgilio "fgilio (1 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")[![fridzema](https://avatars.githubusercontent.com/u/8180660?v=4)](https://github.com/fridzema "fridzema (1 commits)")

---

Tags

julienbourdeauroute-usage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/julienbourdeau-route-usage/health.svg)

```
[![Health](https://phpackages.com/badges/julienbourdeau-route-usage/health.svg)](https://phpackages.com/packages/julienbourdeau-route-usage)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
