mayaramyadav / spatie-activitylog-ui
A beautiful, modern UI for Spatie's Activity Log with advanced filtering, analytics, and real-time features.
Package info
github.com/mayaramyadav/spatie-activitylog-ui
Language:Blade
pkg:composer/mayaramyadav/spatie-activitylog-ui
Requires
- php: ^8.3
- illuminate/contracts: ^11.0|^12.0|^13.0
- spatie/laravel-activitylog: ^5.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.1|^11.0|^12.0
Suggests
- barryvdh/laravel-dompdf: Required for exporting activity logs to PDF format.
- maatwebsite/excel: Required for exporting activity logs to XLSX format.
README
โจ Spatie Activitylog UI
A beautiful, modern, and lightning-fast user interface for Spatie's Laravel Activitylog.
Note
This package provides an elegant dashboard and analysis interface. It operates securely on top of your existing activity_log table and assumes you already have Spatie's package installed and logging data.
๐ Key Features
- ๐ Comprehensive Dashboards: View intuitive timeline interfaces, aggregated analytics, and detailed data tables.
- ๐ Powerful Filtering: Instantly search by exact dates, specific events, subjects, causers, and models.
- ๐พ Saved Views: Save your favorite dashboard queries and share default views with your team.
- โก Zero Build Steps: Styled beautifully with Tailwind CSS and powered by Alpine.js nativelyโno NPM commands required!
- ๐ก๏ธ Rock-Solid Security: Built-in authorization gates, flexible middleware support, and granular user/role whitelists.
- ๐ฅ Robust Exporting System: Export millions of records safely to CSV, JSON, Excel (XLSX), or PDF with built-in Laravel Queue background jobs.
๐ ๏ธ Requirements
Before installing, ensure your server meets the following requirements:
- PHP:
^8.3 - Laravel:
11.x|12.x|13.x - Spatie Activitylog:
^5.0
Optional Export Dependencies
If you wish to export to Excel or PDF, simply install the required packages. The UI gracefully falls back to CSV if these are missing.
composer require maatwebsite/excel barryvdh/laravel-dompdf
๐ฆ Installation
-
Install the package via Composer:
composer require mayaramyadav/spatie-activitylog-ui
-
Publish Configuration: (Optional but recommended)
php artisan vendor:publish --provider="MayaramYadav\SpatieActivitylogUi\SpatieActivitylogUiServiceProvider" --tag="spatie-activitylog-ui-config"
-
Publish Assets & Views: (Optional if you wish to override styling)
php artisan vendor:publish --provider="MayaramYadav\SpatieActivitylogUi\SpatieActivitylogUiServiceProvider" --tag="spatie-activitylog-ui-assets" php artisan vendor:publish --provider="MayaramYadav\SpatieActivitylogUi\SpatieActivitylogUiServiceProvider" --tag="spatie-activitylog-ui-views"
-
Verify Database Configuration: If you have not already migrated Spatie's activity log, run:
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations" php artisan migrate
You are now ready to go! ๐ Visit /spatie-activitylog-ui in your browser to access the dashboard.
โ๏ธ Configuration
Your config/spatie-activitylog-ui.php file dictates the entire appearance and permissions of the package.
Core Settings
'route' => [ 'prefix' => 'spatie-activitylog-ui', // The root URL of the UI 'middleware' => ['web', 'auth'], // Who can access the base route ],
Authorization (Gates & Access Control)
By default, the package is locked down out of the box.
'authorization' => [ 'enabled' => true, 'gate' => 'viewActivityLogUi', // Intercept via app/Providers/AuthServiceProvider.php ], 'access' => [ 'allowed_users' => ['admin@example.com'], // Or allow specific emails natively 'allowed_roles' => ['super-admin'], // Or specific Spatie Roles ],
๐ก Analytics & Caching
The dashboard relies on caching to prevent heavy queries from lagging your database when dealing with millions of log rows.
'features' => [ 'analytics' => true, // Turn on/off the top metrics bar ], 'performance' => [ 'cache_prefix' => 'spatie_al_ui', 'eager_load_relations' => ['causer', 'subject'], // Optimize N+1 issues ],
๐ฅ๏ธ Background Export Jobs
If your database contains millions of rows, attempting to export them via HTTP will likely result in a timeout. We bypass this by queuing exports seamlessly:
'exports' => [ 'enabled_formats' => ['csv', 'xlsx', 'pdf', 'json'], // Limits 'max_records' => 100000, 'queue' => [ 'enabled' => true, // Run exports via the Laravel Job queue! 'queue_name'=> 'exports', ], // Get alerted when large exports are ready to download 'notifications' => [ 'enabled' => true, 'channels' => ['mail'] ] ],
๐ค Contributing
We welcome your PRs and feature requests! Please open an issue to discuss major changes before making a pull request.
๐ License
This package is free and open-source software distributed under the terms of the MIT License. See LICENSE for details.