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

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

ismail1k/laravel-analytics
==========================

A laravel package that can help you to measure traffic on your website!

1.0.0(3y ago)011MITPHPPHP &gt;=7.2.0

Since Oct 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ismail1k/laravel-analytics)[ Packagist](https://packagist.org/packages/ismail1k/laravel-analytics)[ RSS](/packages/ismail1k-laravel-analytics/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

laravel-Analytics
=================

[](#laravel-analytics)

A laravel package that can help you to measure traffic on your website!

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

[](#installation)

First, install Package to your laravel project with Composer using command bellow:

```
composer require ismail1k/laravel-analytics
```

then add these follow lines to `config/app.php`:

```
  'providers' => [
      Ismail1k\LaravelAnalytics\ServiceProvider::class,
  ],
  'aliases' => [
      'Tracker' => Ismail1k\LaravelAnalytics\CartServiceProvider::class,
  ],
```

Now, open `app/Http/kernel.php` and add this line:

```
  protected $routeMiddleware = [
       ...
      'tracker' => \App\Http\Middleware\TrackerMiddleware::class,
  ];
```

Next step, publish some files:

```
php artisan vendor:publish --provider="Ismail1k\LaravelAnalytics\ServiceProvider"
```

then, run the follow command line:

```
php artisan migrate
```

Usage
-----

[](#usage)

If you want to track all your routes, open `app/Providers/RouteServiceProvider.php` add tracker middleware to your web group routes like this:

```
  Route::middleware(['web', 'tracker'])
      ->group(base_path('routes/web.php'));
```

Also do this if you want to track your api group routes:

```
  Route::middleware(['api', 'tracker'])
      ->prefix('api')
      ->group(base_path('routes/api.php'));
```

Or you can track requests from Controller like this:

```
