PHPackages                             aleksa/laravel-visitors-statistics - 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. aleksa/laravel-visitors-statistics

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

aleksa/laravel-visitors-statistics
==================================

Simple visitor tracker and statistics package for Laravel 5 that can be used for dashboard graphs.

v7.0.0(6y ago)20777[1 issues](https://github.com/nikolicaleksa/laravel-visitors-statistics/issues)[1 PRs](https://github.com/nikolicaleksa/laravel-visitors-statistics/pulls)MITPHPPHP ^7.1.3

Since Jun 5Pushed 5y ago2 watchersCompare

[ Source](https://github.com/nikolicaleksa/laravel-visitors-statistics)[ Packagist](https://packagist.org/packages/aleksa/laravel-visitors-statistics)[ RSS](/packages/aleksa-laravel-visitors-statistics/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (7)Versions (7)Used By (0)

Laravel Visitor Statistics
==========================

[](#laravel-visitor-statistics)

[![Packagist](https://camo.githubusercontent.com/02a5fbf6ec7cbbb8d3afa7a3deea8a56bf79b0536da6c104469900053a1f3794/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c656b73612f6c61726176656c2d76697369746f72732d737461746973746963732e737667)](https://packagist.org/packages/aleksa/laravel-visitors-statistics) [![Packagist](https://camo.githubusercontent.com/8f0bdfd81e37c77ac60dcb3e5003b5c6550453265ccebb7f28c43fbe565c204c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f616c656b73612f6c61726176656c2d76697369746f72732d737461746973746963732e737667)](https://packagist.org/packages/aleksa/laravel-visitors-statistics) [![Packagist](https://camo.githubusercontent.com/62cb027265cb094b3519260ee91e6cd897a9c3bdd27acdb0b9dad2a722f72ce1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616c656b73612f6c61726176656c2d76697369746f72732d737461746973746963732e737667)](https://opensource.org/licenses/MIT)

Simple visitor tracker and statistics package for Laravel 5 that can be used for dashboard graphs. Includes controller and routes to fetch visitor statistics (all and unique visits) for a certain month or year. You can also get total number of visits per country.

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

[](#installation)

1. Install package using composer:

```
composer require aleksa/laravel-visitors-statistics
```

2. Since the package automatically adds it's middleware to `web` group you will have to register service provider manually

```
...
'providers' => [
    ...
    Aleksa\LaravelVisitorsStatistics\Providers\VisitorStatisticsProvider::class,
    ...
],
...
```

3. Run migrations:

```
php artisan migrate
```

4. Publish configuration:

```
php artisan vendor:publish
```

and choose `Aleksa\LaravelVisitorsStatistics\Providers\VisitorStatisticsProvider` from the list

5. Download MaxMind database

```
php artisan maxmind:update
```

GeoIP
-----

[](#geoip)

Since fetching data from external API (eg: [ipstack](https://ipstack.com/), [ipdata](https://ipdata.co/) etc...) takes time and slows down your application and can also produce monthly costs the package uses local MaxMind database and `maxmind-db/reader` package for reading it's contents and locating the visitors.

For more sophisticated tracking you should use something like [Google Analytics](https://analytics.google.com/).

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

[](#configuration)

NameDescriptionDefaulttrack\_authenticated\_usersShould the tracker track authenticated usersfalsetrack\_ajax\_requestShould the tracker track ajax requestsfalselogin\_route\_pathAdmin login path so that login attempts don't track as visits'admin'prefixPrefix to apply to all statistics fetching routes'admin'middlewareMiddlewares to be applied to all statistics fetching routes'\['web', 'auth'\]'database\_locationLocation where to store MaxMind databasestorage\_path('app/maxmind.mmdb')database\_download\_urlMaxMind database download urlMAXMIND\_URLauto\_updateShould laravel automatically update MaxMind databasetrue**NOTE:** If you set `auto_update` to true make sure to add Laravel cron entry that is needed for [Task Scheduling](https://laravel.com/docs/5.8/scheduling).

Fetching statistics
-------------------

[](#fetching-statistics)

The package comes with a controller and a bunch of routes to fetch statistics. The idea is to fetch statistics on your dashboard with AJAX request and parse data to some JavaScript graph library like [Highcharts](https://www.highcharts.com/).

Route nameRoute URIDescriptionvisitorstatistics.all\_statistics/statistics/{year}/{month?}Get statistics for the given year or month.visitorstatistics.unique\_statistics/statistics/unique/{year}/{month?}Get unique statistics for the given year or month.visitorstatistics.total\_statistics/statistics/total/{year}/{month?}Get both all and unique statistics for a given year or month.visitorstatistics.countries/statistics/countriesGet visits count and percentage for each country.visitorstatistics.available\_dates/statistics/available/{year?}Get years or months that have statistics tracked.**NOTE:** All routes are prefixed with value set in configuration and return response in `JSON` format.

Example responses
-----------------

[](#example-responses)

`/admin/statistics/2019`

```
{
    "data": {
        "1": 712,
        "2": 1379,
        "3": 1095,
        "4": 624,
        "5": 1181,
        "6": 271,
        "7": 0,
        "8": 0,
        "9": 0,
        "10": 0,
        "11": 0
    }
}
```

`/admin/statistics/2019/6`

```
{
    "data": {
        "1": 76,
        "2": 33,
        "3": 35,
        "4": 54,
        "5": 73,
        "6": 0,
        "7-26": "...",
        "27": 0,
        "28": 0,
        "29": 0
    }
}
```

`/admin/statistics/total/2019`

```
{
    "all": {
        "1": 0,
        "2": 0,
        "3": 0,
        "4": 0,
        "5": 0,
        "6": 271,
        "7": 0,
        "8": 0,
        "9": 0,
        "10": 0,
        "11": 0
    },
    "unique": {
        "1": 0,
        "2": 0,
        "3": 0,
        "4": 0,
        "5": 0,
        "6": 42,
        "7": 0,
        "8": 0,
        "9": 0,
        "10": 0,
        "11": 0
    }
}
```

`/admin/statistics/countries`

```
{
    "data": [
        {
            "country": "Germany",
            "count": 6,
            "percentage": 40
        },
        {
            "country": "United States",
            "count": 4,
            "percentage": 26.67
        },
        {
            "country": "Unknown",
            "count": 2,
            "percentage": 13.33
        },
        {
            "country": "Thailand",
            "count": 1,
            "percentage": 6.67
        },
        {
            "country": "Russia",
            "count": 1,
            "percentage": 6.67
        },
        {
            "country": "Serbia",
            "count": 1,
            "percentage": 6.67
        }
    ]
}
```

`/admin/statistics/available`

```
{
    "data": [
        2019
    ]
}
```

Information being collected
---------------------------

[](#information-being-collected)

This is the data that is being tracked for each visitor.

NameDescriptionipe.g. '127.0.0.1'countrye.g. 'Serbia'citye.g. 'Belgrade'devicee.g. 'desktop'browsere.g. 'Chrome'License
-------

[](#license)

This is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

Recently: every ~71 days

Total

6

Last Release

2294d ago

Major Versions

v1.0.3 → v6.0.02020-03-15

v6.0.0 → v7.0.02020-03-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/668c7ded62e3c83e197c6c766b8a1e53619d7b3a7583bc8888af5bd01ad1df5b?d=identicon)[nikolicaleksa](/maintainers/nikolicaleksa)

---

Top Contributors

[![nikolicaleksa](https://avatars.githubusercontent.com/u/50905985?v=4)](https://github.com/nikolicaleksa "nikolicaleksa (17 commits)")

### Embed Badge

![Health badge](/badges/aleksa-laravel-visitors-statistics/health.svg)

```
[![Health](https://phpackages.com/badges/aleksa-laravel-visitors-statistics/health.svg)](https://phpackages.com/packages/aleksa-laravel-visitors-statistics)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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