This package keeps track of all requests in order to know what controller method was used. The goal is to find out if there are unused endpoints or controller methods in your app. This is not to build any sort of analytics!
After a few years, any projects have dead code and unused endpoints. Typically, you removed a link
on your frontend, nothing ever links to that old
/special-page. You might want to remove it, but
you're not sure.
With this package, you can have look at the
route_usage table and figure out when this page was accessed
for the last time.
When was this page used for the last time? Last week? Better keep it for now. 3 years ago? REMOVE THE CODE! 🥳
- This package only logs request with a 2xx or 3xx HTTP response. I don't think the rest make sense but if you think it does, please reach out.
- In the very first version, I was incrementing a
countattribute. I removed it because I think it gives a wrong information. If it was used a lot but wasn't accessed for over a year, it might give a false sense of importance to this unused route.
Install the package via composer.
Run migrations to create the new
Optionally, publish the configuration if you need to modify it.
To access the route usage, you can do it in your terminal with the command.
To access the HTML table, you'll first need to define who can access it. By default,
it's available only on
AuthServiceProvide, in the
boot method, specify who can access this page with a gate.
Then, head over to
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.
Road to 1.0 release
Less SQL queries
I'd 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?
07 Dec 2019 | git diff 0.3..0.4
Support other databases - PR #5
Instead of a raw MySQL query, the package is now using Eloquent to save the route usage entries. This brings support to other databases, so tests are now running using SQLite.
29 Oct 2019 | git diff 0.2..0.3
Hide HTML page behind Gate - PR #13
AuthServicePrivder::boot, define a gate:
28 Oct 2019 | git diff 0.1..0.2
Ignore OPTIONS http calls - PR #12
Ignore routes based on their name or uri - PR #6
Add style for HTML view - PR #8
- Initial release