Download the PHP package starfolksoftware/analytics without Composer
On this page you can find all versions of the php package starfolksoftware/analytics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download starfolksoftware/analytics
More information about starfolksoftware/analytics
Files in starfolksoftware/analytics
Package analytics
Short Description Add analytics to your Laravel application
License MIT
Homepage https://github.com/starfolksoftware/analytics
Informations about the package analytics
Add analytics to your Laravel application
Add the ability to associate analytics to your Laravel Eloquent models.
Installation
You can install the package via composer:
The package will automatically register itself.
You can publish the migration with:
After the migration has been published you can create the media-table by running the migrations:
You can publish the config-file with:
To register the Viewed
event, CaptureView
and CaptureVisit
listeners, edit your EventServiceProvider
as in the following:
Usage
Registering Models
To let your models be able to have analytics, add the HasViews
, HasVisits
traits to the model classes.
Usage
To trigger the viewed event on your model, you can call the event()
helper method. It receives the intance of the Viewed
.
This event triggers the CaptureView
and CaptureVisit
listeners.
Retrieving Analytics
The models that use the HasViews
and HasVisits
traits have access to it's analytics using the views
and visits
relations respectively:
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Faruk Nasir
- All Contributors
License
The MIT License (MIT). Please see License File for more information.