PHPackages                             nietthijmen/laravel-tracer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nietthijmen/laravel-tracer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nietthijmen/laravel-tracer
==========================

Trace where users went by bundling routes

v1.0.2(2mo ago)11[2 PRs](https://github.com/NietThijmen/laravel-tracer/pulls)MITPHPPHP ^8.3CI passing

Since Mar 2Pushed 1mo agoCompare

[ Source](https://github.com/NietThijmen/laravel-tracer)[ Packagist](https://packagist.org/packages/nietthijmen/laravel-tracer)[ Docs](https://github.com/nietthijmen/laravel-tracer)[ Fund](https://www.buymeacoffee.com/nietthijmen)[ RSS](/packages/nietthijmen-laravel-tracer/feed)WikiDiscussions main Synced 1mo ago

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

Laravel tracer
==============

[](#laravel-tracer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b55a469314590702b11c7c1da0ef83f3a7bfea1ed0788591304a83e45459ae36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6965747468696a6d656e2f6c61726176656c2d7472616365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nietthijmen/laravel-tracer)[![GitHub Tests Action Status](https://camo.githubusercontent.com/219b0bbad0621cca108a00ff54ab6852c55a238a7a881f0be686ad0e75516a04/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e6965747468696a6d656e2f6c61726176656c2d7472616365722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/nietthijmen/laravel-tracer/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/66767add0179e2d65db2984671a9caef0e26d89dc9cfb9a646c7aea10e3944be/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e6965747468696a6d656e2f6c61726176656c2d7472616365722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/nietthijmen/laravel-tracer/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e2ef5f854c775045cb13030b9fa8eca542d49ba28e2f04374eb863278800e0c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6965747468696a6d656e2f6c61726176656c2d7472616365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nietthijmen/laravel-tracer)

Get better insights in the patterns of your users with Laravel tracer, a package that allows you to easily trace user interactions in your Laravel application.

This can be used for a variety of use cases, such as:

- Analytics: Get insights in how users interact with your application, which routes are most popular, etc.
- Heuristics: Optimise the routes your users are actually using, for example by caching the most popular routes.
- Debugging: Get insights in how users are interacting with your application, which can help you identify issues and bugs.

This package doesn't use any external services, all traces are stored in your own database, so you have full control over the data and can easily query it to get the insights you need.

(This package is inspired by the work done by [protonemedia](https://github.com/protonemedia) their [package](https://github.com/protonemedia/laravel-tracer), but since they're package is archived for over 2 years, I decided to create a new package with the same functionality but with a more modern approach, and also with some additional features such as the prunable traces and extra configs.)

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

[](#installation)

You can install the package via composer:

```
composer require nietthijmen/laravel-tracer
php artisan laravel-tracer:install
```

This is optional but recommended, but the traces are [prunable](https://laravel.com/docs/12.x/eloquent#pruning-models), so you can set up a schedule to prune old traces, for example:

```
use Illuminate\Support\Facades\Schedule;

Schedule::command('model:prune', [
    '--model' => [
        \Nietthijmen\LaravelTracer\Models\UserTrace::class
    ],
])->daily();
```

Usage
-----

[](#usage)

The package has 2 middleware, aliased as: traceUser &amp; qualify The qualify middleware allows you to "overwrite" the route name used for tracing, this is useful for when multiple routes can be grouped together, for example: all routes related to a specific resource.

```
Route::middleware(['auth', 'traceUser', 'qualify:resource'])->group(function () {
    Route::get('/resource', [ResourceController::class, 'index'])->name('resource.index');
    Route::get('/resource/{id}', [ResourceController::class, 'show'])->name('resource.show');
});
```

You can then use the `UserTrace` model to query the traces, for example:

```
use NietThijmen\LaravelTracer\Models\UserTrace;
$traces = UserTrace::where('qualified_route', 'resource')->get();
```

There's also some configs for the package which get auto-published when you run the install command, you can find them in `config/tracer.php`These configs allow you to set what gets traced (user agent, ip address, etc.) and also allow you to set a custom model for the traces.

Changelog
---------

[](#changelog)

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

Credits
-------

[](#credits)

- [Thijmen Rierink](https://github.com/NietThijmen)
- [All Contributors](../../contributors)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance89

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

72d ago

### Community

Maintainers

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

---

Top Contributors

[![NietThijmen](https://avatars.githubusercontent.com/u/53520119?v=4)](https://github.com/NietThijmen "NietThijmen (32 commits)")

---

Tags

analyticslaravellaravel-packagelaravelanalyticsuser trackinglaravel-tracer

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/nietthijmen-laravel-tracer/health.svg)

```
[![Health](https://phpackages.com/badges/nietthijmen-laravel-tracer/health.svg)](https://phpackages.com/packages/nietthijmen-laravel-tracer)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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