PHPackages                             rvxlab/laravel-analytics - 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. rvxlab/laravel-analytics

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

rvxlab/laravel-analytics
========================

Simple and lightweight analytics and tag manager for Laravel

0.0.3(1y ago)012[2 issues](https://github.com/RVxLab/laravel-analytics/issues)MITPHPPHP ^8.2

Since Jul 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/RVxLab/laravel-analytics)[ Packagist](https://packagist.org/packages/rvxlab/laravel-analytics)[ RSS](/packages/rvxlab-laravel-analytics/feed)WikiDiscussions main Synced today

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

Laravel Analytics
=================

[](#laravel-analytics)

> 🚧 This package is still a work in progress

A simple, extremely lightweight analytics package.

Requirements
------------

[](#requirements)

- Laravel 10+

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

[](#installation)

Install using Composer:

```
composer require rvxlab/laravel-analytics
```

Publish and run the migrations:

```
php artisan vendor:publish --tag="analytics-migrations"

php artisan migrate
```

**Optional**: Publish the config file:

```
php artisan vendor:publish --tag="analytics-config"
```

Setting up
----------

[](#setting-up)

There are 2 ways of setting up analytics:

1. Globally
2. In a route group

### Globally (Laravel 11)

[](#globally-laravel-11)

Add the `RVxLab\Analytics\Middleware\RecordPageView` middleware by calling `append` or `appendToGroup` on the `Illuminate\Foundation\Configuration\Middlewares` parameter of the `withMiddleware` call:

```
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Middleware;
use RVxLab\Analytics\Middleware\RecordPageView;

return Application::configure(basePath: dirname(__DIR__))
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->append([RecordPageView::class]);
        // OR
        $middleware->appendToGroup('', [RecordPageView::class]);
    })->create();
```

### Globally (Laravel 10 and 11 without the new slim skeleton)

[](#globally-laravel-10-and-11-without-the-new-slim-skeleton)

Add the `RVxLab\Analytics\Middleware\RecordPageView` middleware to the end of your `middleware` array or the relevant group in your `middlewareGroups` array of your `App\Http\Kernel`:

```
namespace App\Http;

use RVxLab\Analytics\Middleware\RecordPageView;

class Kernel
{
    protected $middleware = [
        // --snip--
        RecordPageView::class,
    ];

    protected $middlewareGroups = [
        'web' => [
            // --snip--
            RecordPageView::class,
        ],
    ];
}
```

### Per route

[](#per-route)

You can add the `RVxLab\Analytics\Middleware\RecordPageView` middleware to a single route or to a group of routes:

```
use App\Http\Controllers\HomeController;
use RVxLab\Analytics\Middleware\RecordPageView;

Route::get('/', HomeController::class)->middleware([RecordPageView::class]);

// OR

Route::middleware([RecordPageView::class])->group(function () {
    Route::get('/', HomeController::class);
});
```

### Dealing with proxies

[](#dealing-with-proxies)

If your application is behind a proxy, make sure that proxy is defined in the trusted proxies.

Not doing so will cause the address in your analytics to always be `127.0.0.1`.

For example, if you use a simple site provisioned through Laravel Forge, you will want to add `'127.0.0.1'` to your trusted proxies. If you're behind a load balance through AWS or go through CloudFlare, you may not know what IP the request will come from. In that case, just add `'*'` to your trusted proxies.

See [the Laravel documentation on trusted proxies](https://laravel.com/docs/11.x/requests#configuring-trusted-proxies) for more information.

Using a separate database
-------------------------

[](#using-a-separate-database)

If you wish to use a separate database for analytics, add an `ANALYTICS_DB_CONNECTION` environment variable and set it to the connection you want to use. Make sure it exists in your `config/database.php` file.

Changelog
---------

[](#changelog)

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

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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 ~15 days

Total

2

Last Release

700d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46111684?v=4)[rvxlab](/maintainers/rvxlab)[@RVxLab](https://github.com/RVxLab)

---

Top Contributors

[![RVxLab](https://avatars.githubusercontent.com/u/46111684?v=4)](https://github.com/RVxLab "RVxLab (27 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rvxlab-laravel-analytics/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[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.

5021.9k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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