cetiia/laravel-activity-log
Laravel package that automatically records application activity to a logs table after migration and provides an activity-log route to view entries. Includes publishable migrations and optional views; access to the route can be protected via a Gate in AuthServiceProvider.
Illuminate\Queue\Events\JobProcessed, eloquent.*, etc.) to log activities, aligning well with Laravel’s native architecture. This reduces boilerplate for tracking model changes, API calls, or system events.activity_logs table) must be manually managed or scaffolded.ActivityLog facade or service provider bindings).activity_logs table (risk of misconfiguration).users)?activity_logs table?Illuminate\Foundation\Events + a custom table suffice?spatie/laravel-activitylog (more mature) worth the switch?sync:handle or queues), but this requires explicit configuration.activity_logs table (or use a seed/migration template from the package’s config).id, user_id, event, old_values, new_values, created_at.AppServiceProvider@boot():
User::observe(ActivityLogObserver::class);
Creating, Updating) with a global listener.php artisan vendor:publish --tag="activity-log-config") to customize logged fields, excluded models, or event mappings.User::create(), Post::update()).ActivityLog::logEvent(), but requires manual wiring.auth()->user() in observers).boot() methods). Use method priority checks if needed.User, Order).activity_logs table for large datasets.try-catch blocks).LogQueryBuilder facade for reusable queries.old_values). Restrict access via Laravel gates/policies.activity_logs table growth.queue:work to batch log writes.email but not password).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Database connection drops | Lost logs during outages. | Use queues + retries (queue:failed table). |
| Observer throws unhandled exception | Breaks model operations. | Wrap observer logic in try-catch. |
| Schema misconfiguration | Logs unreadable or missing data. | Use migrations + CI checks for schema. |
| High log volume | Slow queries, storage bloat. | Indexes, archiving, or sampling (log 10% of events). |
| Laravel event system disabled | Logs not triggered. | Fallback to middleware or direct DB inserts. |
queue:retry).How can I help you explore Laravel packages today?