Skip to content

A powerful, feature-rich activity logging solution for FilamentPHP v4/v5 with timeline views, dashboard widgets, and revert actions.

License

Notifications You must be signed in to change notification settings

AlizHarb/filament-activity-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Filament Activity Log

Filament Activity Log

License Latest Version on Packagist Total Downloads PHP Version

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

🎯 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
PHP 8.3+ βœ…
Laravel 11+ βœ…
Filament v4+ / v5+ βœ…

Dependencies:


⚑ 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}";
    }
}

πŸ“š Batch Support

Automatically group activities from a single job or request. Use the View Batch action in the Activity Log table to inspect all activities related to a specific batch UUID.


βš™οΈ Configuration

You can customize almost every aspect of the package via the filament-activity-log.php config file.

πŸ“š For detailed configuration instructions, including navigation groups and custom authorization, see CONFIGURATION.md

Customizing Table Columns

'table' => [
    'columns' => [
        'log_name' => [
            'visible' => true,
            'searchable' => true,
            'sortable' => true,
        ],
        // ...
    ],
],

Customizing Widgets

'widgets' => [
    '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 without setting up a full permission system:

// In config/filament-activity-log.php
'permissions' => [
    'custom_authorization' => fn($user) => $user->id === 1,
],

See CONFIGURATION.md for more examples.


🀝 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:

Sponsor on GitHub

Your support helps maintain and improve this package! πŸ™


πŸ› Issues & Support


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

About

A powerful, feature-rich activity logging solution for FilamentPHP v4/v5 with timeline views, dashboard widgets, and revert actions.

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors