Download the PHP package arrtrust/tracker without Composer
On this page you can find all versions of the php package arrtrust/tracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tracker
Tracker
Simple site visit/statistics tracker for Laravel 5.
Tracker provides a simple way to track your site visits and their statistics.
Features
- Compatible with Laravel 5
- Middleware for automatically recording the site view
- Associate site views to Eloquent models to track their views
- Persists unique views based on URL, method, and IP address
- Helper method, Facade, and trait for easing access to services
- Handy 'Cruncher' for number crunching needs
- Flushing and selecting site views with given time spans
- A phpunit test suite for easy development
Installation
Installing Tracker is simple.
-
Pull this package in through Composer.
-
In order to register Tracker Service Provider add
'Arrtrust\Tracker\TrackerServiceProvider'
to the end ofproviders
array in yourconfig/app.php
file. -
You may configure the default behaviour of Tracker by publishing and modifying the configuration file. To do so, use the following command.
Than, you will find the configuration file on the
config/tracker.php
path. Information about the options can be found in the comments of this file. All of the options in the config file are optional, and falls back to default if not specified; remove an option if you would like to use the default.This will also publish the migration file for the default
SiteView
model. Do not forget to migrate your database before using Tracker. -
In order to register the Facade add the following line to the end of
aliases
array in yourconfig/app.php
file. -
You may now access Tracker either by the Facade or the helper function.
-
It is important to record views by using the supplied middleware to record correct app runtime and memory information. To do so register the middleware in
app\Http\Kernel
.It is better to register this middleware as a routeMiddleware instead of a global middleware and use it in routes or route groups definitions as it may not be necessary to persist all site view. This will persist and attach any Trackable that is added to stack to site views automatically when the request has been handled by Laravel.
-
To attach views to any model or class, you should implement the
Arrtrust\Tracker\TrackableInterface
interface. Tracker providesArrtrust\Tracker\Trackable
trait to be used by Eloquent models.The
Trackable
trait uses Eloquent'sbelongsToMany
relationship which utilizes pivot tables. Here is a sample migration for the pivot table: - Check the
Arrtrust\Tracker\Cruncher
class and test for statistics number crunching. It is equipped with a number of methods for different types of statistics (mostly counts) in different time spans.
Please check the tests and source code for further documentation, as the source code of Tracker is well tested and documented.
License
Tracker is released under MIT License.