spatie/laravel-activitylog
Log user and model activity in Laravel with a simple API. Automatically record Eloquent events, track subjects and causers, attach custom properties, and query everything via the Activity model. Stores logs in the activity_log table.
Adopt if:
created, updated, deleted).Look Elsewhere if:
"This package lets us automatically track every user action in our Laravel app—like a digital breadcrumb trail—without extra dev work. It’s MIT-licensed, battle-tested (5.8K GitHub stars), and solves compliance/audit needs out-of-the-box. For example, if a customer disputes a charge, we can instantly show who modified their account. It’s a force multiplier for support, security, and trust."
ROI:
*"This is a drop-in solution for audit logging in Laravel. Key benefits:
activity()->log('Action') or auto-capture Eloquent events.clean_after_days config to prune old logs).Trade-offs:
activity_log table).Example Use Case:
// Auto-log model updates
$post->title = 'New Title';
$post->save(); // Logs: 'updated', with `attribute_changes` diff.
// Manual logging
activity()
->performedOn($post)
->causedBy(auth()->user())
->withProperties(['ip' => request()->ip()])
->log('Published post');
Next Steps:
Activity model or config for your needs.Activity::all() to verify logs during testing.Alternatives Considered:
Recommendation: Adopt for MVP, then iterate based on usage patterns."*
How can I help you explore Laravel packages today?