Activity Log
A powerful, feature-rich activity logging solution for FilamentPHP v4 & v5 with timeline views, dashboard widgets, and revert actions.
Author:
Ali Harb
Documentation
- 📖 Table of Contents
- ✨ Features
- 📋 Requirements
- ⚡ Installation
- 🎯 Quick Start
- 🎯 Core Features
- ⚙️ Configuration
- 🤝 Contributing
- 💖 Sponsor This Project
- 🐛 Issues & Support
- 📄 License
- 🙏 Acknowledgments
A powerful, feature-rich activity logging solution for FilamentPHP v4 & v5
Seamlessly track, view, and manage user activities with beautiful timelines and insightful dashboards.
Built on spatie/laravel-activitylog
#📖 Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Core Features
- Configuration
- Usage Examples
- Contributing
- License
#✨ Features
#🎯 Core Functionality
- 📦 Full Resource Integration - Dedicated resource to browse, filter, and search logs
- ⏱️ Timeline View - Stunning slide-over timeline to visualize record history
- 📊 Insightful Widgets - Activity charts and latest activity tables
- 🔗 Relation Manager - Add activity history to any resource
- 🎨 Highly Customizable - Configure labels, colors, icons, and visibility
- 🔐 Role-Based Access - Fully compatible with Filament's authorization
- 🌍 Dark Mode Support - Beautiful in both light and dark modes
#📋 Requirements
| Requirement | Version | Status |
|---|---|---|
| 8.3+ | ✅ | |
| 11+ | ✅ | |
| v4+ / v5+ | ✅ |
Dependencies:
- Spatie Laravel Activitylog (^4.0 or ^5.0) - The robust foundation
#Spatie Activitylog Compatibility
| Spatie Version | Support | Notes |
|---|---|---|
| ^4.0 | Full | Legacy support with native batch_uuid and properties-based tracking |
| ^5.0 | Full | Requires the official v5 upgrade migration (see below) |
Important for v5 users: You must follow Spatie's official v5 upgrade guide before using this plugin on v5. This includes:
- Adding the
attribute_changescolumn- Dropping the
batch_uuidcolumn- Migrating tracked change data from
propertiesintoattribute_changesThe plugin does not support an unmigrated v5 database.
Key differences between v4 and v5:
- Tracked changes: v4 stores changes in
properties['attributes']/properties['old']. v5 uses the dedicatedattribute_changescolumn. The plugin reads from both automatically. - Batch grouping: v4 uses the native
batch_uuidcolumn. v5 uses custom-property grouping (properties['group']) per the official docs. The plugin handles both transparently. - Relationships: v5 renames
activities()toactivitiesAsSubject()andactions()toactivitiesAsCauser(). The plugin detects and uses whichever is available.
#⚡ Installation
#Step 1: Install via Composer
composer require alizharb/filament-activity-log
#Step 2: Register the Plugin
Add to your AdminPanelProvider:
use AlizHarb\ActivityLog\ActivityLogPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
ActivityLogPlugin::make()
->label('Log')
->pluralLabel('Logs')
->navigationGroup('System')
->cluster('System'), // Optional: Group inside a cluster
]);
}
#Step 3: Install Assets & Config
Run the installation command to publish the configuration, assets, and migrations:
php artisan filament-activity-log:install
#🎯 Quick Start
#1. Enable Logging on Models
Ensure your models use the LogsActivity trait:
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;
class User extends Authenticatable
{
use LogsActivity;
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logAll();
}
}
#2. Configure Tracking (Optional)
To automatically capture IP addresses and user agent information, add the generic tap to your config/activitylog.php:
'activity_logger_taps' => [
\AlizHarb\ActivityLog\Taps\SetActivityContextTap::class,
],
#3. View Activities
Navigate to the Logs resource in your admin panel to see all tracked activities.
#🎯 Core Features
#📦 Activity Log Resource
A dedicated resource allows you to manage all activity logs.
Features:
- ✅ Advanced Filtering - Filter by causer, subject, event type, and date
- ✅ Global Search - Search through log descriptions and properties
- ✅ Detailed View - Inspect every detail of an activity log
#⏱️ Timeline View
Visualize the history of any record with a beautiful timeline.
Usage: The timeline is available as a table action in the Relation Manager or can be added to any page.
#📊 Dashboard Widgets
#Activity Chart Widget
Displays a line chart showing activity trends over time.
use AlizHarb\ActivityLog\Widgets\ActivityChartWidget;
public function getWidgets(): array
{
return [
ActivityChartWidget::class,
];
}
#Latest Activity Widget
Shows a list of the most recent activities.
use AlizHarb\ActivityLog\Widgets\LatestActivityWidget;
public function getWidgets(): array
{
return [
LatestActivityWidget::class,
];
}
#🔗 Relation Manager
Add an activity log history table to any of your existing resources (e.g., UserResource).
use AlizHarb\ActivityLog\RelationManagers\ActivitiesRelationManager;
public static function getRelations(): array
{
return [
ActivitiesRelationManager::class,
];
}
#🏷️ Customizable Subject Titles
The package automatically checks for name, title, or label attributes on your models.
For more control, implement the HasActivityLogTitle interface on your model:
use AlizHarb\ActivityLog\Contracts\HasActivityLogTitle;
class User extends Model implements HasActivityLogTitle
{
public function getActivityLogTitle(): string
{
return "User: {$this->email}";
}
}
#📚 Activity Grouping / Batch Support
Automatically group activities from a single job or request. Use the View Batch action in the Activity Log table to inspect all related activities.
- Spatie v4: Uses the native
batch_uuidcolumn for grouping. - Spatie v5: Uses custom-property grouping (
properties['group']), since upstream batch support was removed in v5. The plugin handles this automatically via theSetActivityContextTap.
#⚙️ Configuration
You can customize almost every aspect of the package via the filament-activity-log.php config file.
#Customizing Table Columns
'table' => [
'columns' => [
'log_name' => [
'visible' => true,
'searchable' => true,
'sortable' => true,
],
// ...
],
],
#Customizing Widgets
'widgets' => [
'widgets' => [
\AlizHarb\ActivityLog\Widgets\ActivityChartWidget::class,
\AlizHarb\ActivityLog\Widgets\LatestActivityWidget::class,
],
'activity_chart' => [
'enabled' => true,
'days' => 30,
'fill_color' => 'rgba(16, 185, 129, 0.1)',
'border_color' => '#10b981',
],
'latest_activity' => [
'enabled' => true,
'limit' => 10,
],
],
#Custom Authorization
Restrict access to specific users by implementing a custom authorizer invokable class:
// app/Authorizer/ActivityLogAuthorizer.php
namespace App\Authorizer;
class ActivityLogAuthorizer
{
public function __invoke(User $user): bool
{
// Define your custom logic to determine if the user can access the activity log.
return $user->id === 1;
}
}
Then register it in the config:
// config/filament-activity-log.php
'permissions' => [
'custom_authorization' => \App\Authorizer\ActivityLogAuthorizer::class,
],
#🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
#Development Setup
# Clone repository
git clone https://github.com/alizharb/filament-activity-log.git
# Install dependencies
composer install
# Run tests
composer test
# Format code
composer format
#💖 Sponsor This Project
If this package helps you, consider sponsoring its development:
Your support helps maintain and improve this package! 🙏
#🐛 Issues & Support
- 🐛 Bug Reports: Create an issue
- 💡 Feature Requests: Request a feature
- 💬 Discussions: Join the discussion
#📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
#🙏 Acknowledgments
The author
A powerful, feature-rich activity logging solution for FilamentPHP v4 & v5 with timeline views, dashboard widgets, and revert actions.
From the same author
Modular Luncher
The ultimate module management solution for Filament and Laravel Modular. Install, update, backup, and restore modules directly from your admin panel. Supports ZIP uploads, Git repositories, and Composer packages.
Author:
Ali Harb
Themes Manager
An advanced, feature-rich theme management system for Laravel applications using Filament. Built to work seamlessly with `qirolab/laravel-themer`, this package provides a comprehensive admin interface for managing, installing, previewing, and switching themes with ease.
Author:
Ali Harb
Module Manager
A Laravel package that provides a simple and elegant way to manage modules within Filament admin panel projects. It allows developers to register, enable, disable, and organize modules, making modular app development easier and more structured. Now supports Filament v5.
Author:
Ali Harb
Themer Luncher
The ultimate theme management solution for Filament and Laravel Themer. Install, switch, backup, and restore themes directly from your admin panel. Supports ZIP uploads, Git repositories, and local symlinks. Includes widgets for theme stats and recent additions.
Author:
Ali Harb
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight/Raycast like Command Palette to your Filament Panel.
Dennis Koch