ash-powell / apanalytics
A MongoDB Analytics Tracking and Parsing Package
Installs: 2 093
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.4|^8.0.2|^8.2|^8.3
- illuminate/container: ^8.0|^9.0|^10.0
- illuminate/database: ^8.0|^9.0|^10.0
- illuminate/events: ^8.0|^9.0|^10.0
- illuminate/queue: ^10.0
- illuminate/support: ^8.0|^9.0|^10.0
- laravel/framework: ^8.4|^9.0|^10.0
- mongodb/laravel-mongodb: ^4.0
- mongodb/mongodb: ^1.8|^1.11|^1.16
Requires (Dev)
- orchestra/testbench: ~6.0|^7.0|^8.0|^9.0|^10.0
- phpunit/phpunit: ^8.0|^9.0|^10.0
This package is auto-updated.
Last update: 2025-03-14 14:22:04 UTC
README
Simple Logging and Viewing for Analytics using MongoDB - Very rough first draft
Installation
Install via composer
composer require ash-powell/apanalytics
Register Service Provider
Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.
Add service provider to config/app.php
in providers
section
AshPowell\APAnalytics\APAnalyticsServiceProvider::class,
Register Facade
Register package facade in config/app.php
in aliases
section
AshPowell\APAnalytics\Facades\APAnalytics::class,
Publish Configuration File
php artisan vendor:publish --provider="AshPowell\APAnalytics\APAnalyticsServiceProvider" --tag="config"
Publish VueJS Analytic Chart Thing... Requires Vue-ApexCharts
php artisan vendor:publish --provider="AshPowell\APAnalytics\APAnalyticsServiceProvider" --tag="views"
Usage
Extend Analytic Models our Model instead of Elequent
This will make sure the correct db connection and collection are used
use AshPowell\APAnalytics\AnalyticModel as Model; class ViewAnalytic extends Model;
To Log events simply use the built in helper as follows:
trackEvent('collection', $items, $userId = null, $params = []),
- Collection will get plauralised
- Items can be models, collections, or custom (see config for model formatting)
- UserId is who performed the action, nullable, default is logged user
- Params is an array of extra config, nullable also
Security
If you discover any security related issues, please email ash-powell@hotmail.co.uk instead of using the issue tracker.
Credits
This package relies heavily on jenssegers/laravel-mongodb.