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(4mo ago)11[2 PRs](https://github.com/NietThijmen/laravel-tracer/pulls)MITPHPPHP ^8.3CI passing

Since Mar 2Pushed 2mo 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 today

READMEChangelog (3)Dependencies (12)Versions (7)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

38

—

LowBetter than 83% of packages

Maintenance81

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

124d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53520119?v=4)[Thijmen](/maintainers/NietThijmen)[@NietThijmen](https://github.com/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-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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