PHPackages                             simba-jirira-source/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. simba-jirira-source/laravel-analytics

ActiveLibrary

simba-jirira-source/laravel-analytics
=====================================

First-party, self-hosted application analytics for Laravel.

v0.6.1(yesterday)11↑2900%[1 PRs](https://github.com/simba-jirira-source/laravel-analytics/pulls)MITPHPPHP ^8.3CI passing

Since Aug 16Pushed yesterdayCompare

[ Source](https://github.com/simba-jirira-source/laravel-analytics)[ Packagist](https://packagist.org/packages/simba-jirira-source/laravel-analytics)[ Docs](https://packagist.org/packages/simba-jirira-source/laravel-analytics)[ GitHub Sponsors](https://github.com/simba-jirira-source)[ RSS](/packages/simba-jirira-source-laravel-analytics/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (19)Versions (5)Used By (0)

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

[](#laravel-analytics)

First-party, self-hosted application analytics for Laravel.

 [![Latest Version](https://camo.githubusercontent.com/dcb38322914960fd342447c19f8a8a1985abd1ff3e12a4ae3d91752454c41985/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696d62612d6a69726972612d736f757263652f6c61726176656c2d616e616c79746963733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/simba-jirira-source/laravel-analytics) [![License](https://camo.githubusercontent.com/dfb3d12b3bfcf7875b2fb862c0bce4d3443681ba415a599c2583b78addcf5834/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73696d62612d6a69726972612d736f757263652f6c61726176656c2d616e616c79746963733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/simba-jirira-source/laravel-analytics) [![Tests](https://camo.githubusercontent.com/f65ad1938b3ee0fd0057d522b2d4eb3914ff3acacd3e44d0e79a3540fc4f4af0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73696d62612d6a69726972612d736f757263652f6c61726176656c2d616e616c79746963732f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d5465737473267374796c653d666c61742d737175617265)](https://github.com/simba-jirira-source/laravel-analytics/actions/workflows/tests.yml) [![Static Analysis](https://camo.githubusercontent.com/09753a80d4416965bdd87c00861c5392cf5d482c3ca62cba1209f5ec491177b3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73696d62612d6a69726972612d736f757263652f6c61726176656c2d616e616c79746963732f7374617469632d616e616c797369732e796d6c3f6272616e63683d6d61696e266c6162656c3d537461746963253230416e616c79736973267374796c653d666c61742d737175617265)](https://github.com/simba-jirira-source/laravel-analytics/actions/workflows/static-analysis.yml) [![Code Style](https://camo.githubusercontent.com/37c3d379a311dbf8a60faf0d2128c8281de606966250e2cceda160f4c9b9cf2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73696d62612d6a69726972612d736f757263652f6c61726176656c2d616e616c79746963732f636f64652d7374796c652e796d6c3f6272616e63683d6d61696e266c6162656c3d436f64652532305374796c65267374796c653d666c61742d737175617265)](https://github.com/simba-jirira-source/laravel-analytics/actions/workflows/code-style.yml) [![Database](https://camo.githubusercontent.com/c21022049cda2483d228fd6b686eee86fa304e79ed245962223f271bd9fde18e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73696d62612d6a69726972612d736f757263652f6c61726176656c2d616e616c79746963732f64617461626173652e796d6c3f6272616e63683d6d61696e266c6162656c3d4461746162617365267374796c653d666c61742d737175617265)](https://github.com/simba-jirira-source/laravel-analytics/actions/workflows/database.yml) [![Security](https://camo.githubusercontent.com/1c0778fb07ebff6fe89002a3d3b76fc42b89ef3cbc9a5e2a2b4c866cc5633924/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73696d62612d6a69726972612d736f757263652f6c61726176656c2d616e616c79746963732f73656375726974792e796d6c3f6272616e63683d6d61696e266c6162656c3d5365637572697479267374796c653d666c61742d737175617265)](https://github.com/simba-jirira-source/laravel-analytics/actions/workflows/security.yml)

Track page views, unique visitors, HTTP errors, and optional IP bans in your application's own database. Enable an optional Livewire 4 dashboard when you want KPIs, trends, and management screens inside your Laravel app — without routing analytics data through a third-party platform by default.

See [docs/SCREENSHOTS.md](docs/SCREENSHOTS.md) for recommended dashboard screenshots.

Why Laravel Analytics?
----------------------

[](#why-laravel-analytics)

Laravel Analytics provides first-party analytics designed specifically for Laravel applications. It is intended for teams who want analytics data stored alongside their application rather than depending entirely on an external analytics service.

- Analytics data stays in the application's own database
- Tracking is disabled by default
- Raw IP storage is disabled by default
- Privacy-aware visitor hashing
- Laravel-native package architecture (service provider, middleware, contracts, Artisan commands)
- HTTP error analytics alongside traffic metrics
- Optional exact IPv4/IPv6 access controls
- Optional Livewire 4 dashboard with authorization gates
- Configurable retention and pruning
- SQLite, MySQL, and PostgreSQL tested in CI
- Laravel 12 and 13 tested in CI
- PHP 8.3–8.5 tested in CI

Pre-1.0 development. See [GitHub Releases](https://github.com/simba-jirira-source/laravel-analytics/releases) and [CHANGELOG.md](CHANGELOG.md) for released versions.

Key Features
------------

[](#key-features)

CapabilityDefaultNotesPage viewsOffMiddleware-based traffic trackingUnique visitorsPrivacy-aware hashingHashed identifiers; raw IP off by defaultHTTP error analyticsOffFingerprinted error aggregationExact IPv4/IPv6 bansOffOptional middleware enforcementRetention / pruning90 days`analytics:prune` commandLivewire dashboardOffGate or invokable authorization requiredCross-database supportSQLite, MySQL, PostgreSQLIntegration tests in CIReplaceable contractsConfigurableVisitor, traffic, and error recordersComposer security auditingIn CI and `composer verify``security.yml` workflowHow It Differs
--------------

[](#how-it-differs)

CapabilityLaravel AnalyticsExternal analytics integrationData stored in application databaseYesUsually noSelf-hosted analytics dataYesDepends on providerPage viewsYesYesUnique visitorsYesYesHTTP error analyticsYesUsually separate toolingExact IP access controlsYesUsually separateExternal analytics account requiredNoUsually yesLaravel-native Livewire dashboardYes (optional)Depends on providerSQLite / MySQL / PostgreSQL CIYesNot applicableQuick Start
-----------

[](#quick-start)

1. Install the package and publish config plus migrations (see [Installation](#installation)).
2. Run migrations.
3. Enable features explicitly in `config/analytics.php`:

```
'enabled' => true,

'tracking' => [
    'traffic' => true,
    'errors' => true,
],

'ip_banning' => [
    'enabled' => false,
],

'dashboard' => [
    'enabled' => true,
    'authorization' => 'viewAnalyticsDashboard',
    'middleware' => ['web', 'auth'],
],
```

4. Define dashboard authorization in your application:

```
use Illuminate\Support\Facades\Gate;

Gate::define('viewAnalyticsDashboard', fn ($user) => /* your policy */);
```

5. Visit `/analytics` (or your configured `dashboard.path`) when the dashboard is enabled.

When `enabled` is true and tracking toggles are on, middleware is registered on the `web` group automatically.

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

[](#installation)

```
composer require simba-jirira-source/laravel-analytics
```

The service provider registers automatically via Laravel package discovery.

### Publish configuration

[](#publish-configuration)

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

### Publish and run migrations

[](#publish-and-run-migrations)

Migrations are not loaded automatically. Publish them, then migrate:

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

### Publish everything (optional)

[](#publish-everything-optional)

```
php artisan vendor:publish --tag=analytics
php artisan migrate
```

TagContents`analytics-config``config/analytics.php``analytics-migrations`Database migrations`analytics-views`Blade / Livewire views`analytics-lang`Translation files`analytics-assets`Public assetsSee [docs/INSTALLATION.md](docs/INSTALLATION.md) for the full walkthrough.

Privacy by Default
------------------

[](#privacy-by-default)

By default the package:

- does not enable tracking, banning, or the dashboard;
- does not store raw IP addresses;
- hashes visitor identifiers using application-specific salt;
- does not associate authenticated users unless configured;
- excludes dashboard routes from self-tracking.

See [docs/PRIVACY.md](docs/PRIVACY.md). This package provides technical privacy controls but does not itself make an application compliant with any specific privacy law or regulatory framework.

Compatibility
-------------

[](#compatibility)

RequirementSupportedPHP8.3+ (8.3–8.5 in CI)Laravel12, 13Livewire4 (required dependency; dashboard is optional via config)DatabasesSQLite, MySQL, PostgreSQL (integration CI)Dashboard
---------

[](#dashboard)

The optional Livewire 4 dashboard provides overview metrics, traffic trends, top pages and referrers, error details, and IP ban management when explicitly enabled and authorized.

See [docs/DASHBOARD.md](docs/DASHBOARD.md).

Artisan Commands
----------------

[](#artisan-commands)

CommandDescription`analytics:prune`Remove records older than the configured retention window`analytics:ip-ban {ip}`Ban an exact IPv4 or IPv6 address`analytics:ip-unban {ip}`Remove an active banPruning is not scheduled automatically. See [docs/RETENTION.md](docs/RETENTION.md).

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

[](#configuration)

All settings live in `config/analytics.php`. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md) for every key.

Extension points (contracts):

- `SimbaJirira\LaravelAnalytics\Contracts\VisitorIdentifier`
- `SimbaJirira\LaravelAnalytics\Contracts\AnalyticsRecorder`
- `SimbaJirira\LaravelAnalytics\Contracts\ErrorRecorder`

Public integration uses Laravel contracts, config keys, middleware aliases, and Artisan commands. There is no facade; a first-party event API is planned for a future release.

Testing
-------

[](#testing)

```
composer install
composer verify
```

Individual gates:

```
composer test              # prepare, PHPStan, Pint, type coverage, Pest
composer test:types        # Pest type coverage (skipped automatically on Windows)
composer analyse           # PHPStan (level 7)
composer lint:check        # Pint
composer test:unit         # Pest (sequential on Windows, parallel elsewhere)
composer test:database     # cross-database integration tests
composer security:audit    # Composer security audit
```

PHPStan level 7 via Larastan. Run `composer run prepare` before `composer analyse` when analysing locally.

Documentation
-------------

[](#documentation)

TopicDocumentInstallation[docs/INSTALLATION.md](docs/INSTALLATION.md)Configuration[docs/CONFIGURATION.md](docs/CONFIGURATION.md)Privacy[docs/PRIVACY.md](docs/PRIVACY.md)Architecture[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)Visitor identification[docs/VISITOR\_IDENTIFICATION.md](docs/VISITOR_IDENTIFICATION.md)Dashboard[docs/DASHBOARD.md](docs/DASHBOARD.md)Retention[docs/RETENTION.md](docs/RETENTION.md)Releases[docs/RELEASES.md](docs/RELEASES.md)GitHub repository setup[docs/GITHUB\_REPOSITORY\_SETUP.md](docs/GITHUB_REPOSITORY_SETUP.md)Screenshot guidance[docs/SCREENSHOTS.md](docs/SCREENSHOTS.md)Contributing[.github/CONTRIBUTING.md](.github/CONTRIBUTING.md)Security policy[.github/SECURITY.md](.github/SECURITY.md)Changelog[CHANGELOG.md](CHANGELOG.md)Contributing
------------

[](#contributing)

Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) before opening a pull request. See [CODE\_OF\_CONDUCT.md](CODE_OF_CONDUCT.md).

Security
--------

[](#security)

Report security issues privately. See [SECURITY.md](.github/SECURITY.md).

Versioning
----------

[](#versioning)

This project follows [Semantic Versioning](https://semver.org/). APIs may change before `1.0.0`. See [CHANGELOG.md](CHANGELOG.md).

License
-------

[](#license)

The MIT License. See [LICENSE.md](LICENSE.md).

Credits
-------

[](#credits)

- [simba-jirira-source](https://github.com/simba-jirira-source)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bc78e1adf168f507dc6bd54c00fdd8c8be37dd5c002beb49c3686c2bbac06cf?d=identicon)[simba-jirira-source](/maintainers/simba-jirira-source)

---

Top Contributors

[![simba-jirira-source](https://avatars.githubusercontent.com/u/194731497?v=4)](https://github.com/simba-jirira-source "simba-jirira-source (26 commits)")

---

Tags

laravellaravel-packagetrackinganalyticsprivacyself hostedweb-analyticsfirst-partysimba-jirira-sourceapplication-analyticsvisitor-analytics

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/simba-jirira-source-laravel-analytics/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k16.3M154](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9922.4M146](/packages/roots-acorn)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k31.8M160](/packages/laravel-cashier)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M227](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)

PHPackages © 2026

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