me-shaon / laravel-request-analytics
Simple request data analytics package for Laravel projects
Fund package maintenance!
me-shaon
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.5
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- dev-main
- v0.1.0
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-6
- dev-Access-controll
- dev-schedule-data-purning
- dev-fix-middleware-not-trigraing-issue
- dev-dashboard
- dev-store-requests
- dev-middleware
- dev-fixed/replace-icons-with-assets
- dev-feat/add-blade-components
- dev-fix/publishing-migration
- dev-migration
This package is auto-updated.
Last update: 2025-06-16 20:46:28 UTC
README
Simple request data analytics package for Laravel projects.
Installation
You can install the package via Composer:
composer require me-shaon/laravel-request-analytics
You can publish and run the migrations with:
php artisan vendor:publish --tag="request-analytics-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="request-analytics-config"
This is the contents of the published config file:
return [ 'route' => [ 'name' => 'request.analytics', 'pathname' => env('REQUEST_ANALYTICS_PATHNAME', 'analytics'), ], 'capture' => [ 'web' => true, 'api' => true, ], 'queue' => [ 'enabled' => env('REQUEST_ANALYTICS_QUEUE_ENABLED', true), ], 'ignore-paths' => [ ], 'pruning' => [ 'enabled' => env('REQUEST_ANALYTICS_PRUNING_ENABLED', true), 'days' => env('REQUEST_ANALYTICS_PRUNING_DAYS', 90), ], ];
Data Purning
You can delete your data from your database automatically.
If you are using Laravel 11+ then you may use model:prune
command.
Add this to your routes/console.php
use Illuminate\Support\Facades\Schedule; Schedule::command('model:prune', [ '--model' => 'MeShaon\RequestAnalytics\Models\RequestAnalytics', ])->daily();
Or try this bootstarp/app.php
use Illuminate\Console\Scheduling\Schedule; ->withSchedule(function (Schedule $schedule) { $schedule->command('model:prune', [ '--model' => 'MeShaon\RequestAnalytics\Models\RequestAnalytics', ])->daily(); })
If you are using Laravel 10 or below then you may use model:prune
command.
You may define all of your scheduled tasks in the schedule method of your application's App\Console\Kernel
class
<?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { protected function schedule(Schedule $schedule): void { $schedule->command('model:prune', [ '--model' => 'MeShaon\RequestAnalytics\Models\RequestAnalytics', ])->daily(); } }
You can publish the assets with this command:
php artisan vendor:publish --tag="request-analytics-assets"
Optionally, you can publish the views using
php artisan vendor:publish --tag="request-analytics-views"
Usage
$requestAnalytics = new MeShaon\RequestAnalytics(); echo $requestAnalytics->echoPhrase('Hello, MeShaon!');
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.