PHPackages                             michaelnabil230/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. [Database &amp; ORM](/categories/database)
4. /
5. michaelnabil230/laravel-analytics

ActiveLibrary[Database &amp; ORM](/categories/database)

michaelnabil230/laravel-analytics
=================================

This is my package laravel-analytics

31[2 PRs](https://github.com/michaelnabil230/laravel-analytics/pulls)PHP

Since Jul 3Pushed 2y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

[![](https://camo.githubusercontent.com/2bedf63f24cda7efab02da955dc11fb7ef8a060e2f26b73c33a7aac84529b8a3/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f737570706f72742d756b7261696e652e7376673f743d31)](https://supportukrainenow.org)

This is my package laravel-analytics
====================================

[](#this-is-my-package-laravel-analytics)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1f25cbe982e1e6d2ef381c6b09e28951ec866c2c49a9e2df2a5ca96edb548e23/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d69636861656c6e6162696c3233302f6c61726176656c2d616e616c79746963732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/michaelnabil230/laravel-analytics)[![GitHub Tests Action Status](https://camo.githubusercontent.com/efc3997a03fb18e63b8d0091742892b90f1e2ae4bed59218b3cbe19a1756fffc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d69636861656c6e6162696c3233302f6c61726176656c2d616e616c79746963732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/michaelnabil230/laravel-analytics/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/afceee8528a703fdb848fe35e759ed3f7e66b103e85a3e2462807a9c1631bb80/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d69636861656c6e6162696c3233302f6c61726176656c2d616e616c79746963732f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/michaelnabil230/laravel-analytics/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/2dbb087b80e2457ce668f2b03e3cf9007ca1c4fc74572b5ad7657d64c2984482/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d69636861656c6e6162696c3233302f6c61726176656c2d616e616c79746963732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/michaelnabil230/laravel-analytics)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

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

[](#installation)

You can install the package via composer:

```
composer require michaelnabil230/laravel-analytics
```

You can publish and run the migrations with:

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

You can publish the config file with:

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

This is the contents of the published config file:

```
return [

    'ip_model' => Ip::class,
    'session_visiter_model' => SessionVisiter::class,
    'visiter_model' => Visiter::class,

    /*
     * Which route paths are not trackable?
     */
    'ignore_paths' => [
        // 'api/*',
    ],

    /*
     * The Do Not Track Ips is used to disable Analytics for some IP addresses:
     *
     *     '127.0.0.1', '192.168.1.1'
     *
     * You can set ranges of IPs
     *     '192.168.0.1-192.168.0.100'
     *
     * And use net masks
     *      127.0.0.0/24 -> range  127.0.0.1 - 127.0.0.255
     *     '172.17.0.0/255.255.0.0'
     */
    'do_not_track_ips' => [
        '127.0.0.2',
    ],

    /*
    |--------------------------------------------------------------------------
    | Drivers GeoIp
    |--------------------------------------------------------------------------
    |
    | Should the geoip data be collected?
    |
    | Set the geoip driver.
    |
    | Supported: "free_geo_ip", "ip_stack"
    */
    'geo_ip' => [
        'enabled' => true,
        'default' => 'free_geo_ip',
        'drivers' => [
            'ip_stack' => [
                'driver' => MichaelNabil230\LaravelAnalytics\GeoIp\IpStack::class,
                'options' => [
                    'api_key' => '',
                    'headers' => [
                        // 'X-First' => 'foo',
                    ],
                ],
            ],
            'free_geo_ip' => [
                'driver' => MichaelNabil230\LaravelAnalytics\GeoIp\FreeGeoIp::class,
                'options' => [
                    'headers' => [
                        // 'X-First' => 'foo',
                    ],
                ],
            ],
        ],
    ],

    /*
     * All bot if you want defected one.
     */
    'bot_browsers' => [
        'curl',
        'python-requests',
        'python-urllib',
        'wget',
        'unk',
        'perl',
        'go-http-client',
    ],

    /*
     * Laravel internal variables on user authentication and login.
     */
    'authentication' => [
        'guards' => [], // defaults to ['web']
    ],
];
```

### Register Middleware

[](#register-middleware)

You may register the package middleware in the `app/Http/Kernel.php` file:

```
