finds.dev

spatie/laravel-activitylog

Log activity inside your Laravel app

View on GitHubHomepage ↗

★ 5,847PHPMITupdated Jun 2026

// the take

A Laravel package for logging user and model activity to a database table. Handles both manual activity logging and automatic Eloquent model event tracking (created/updated/deleted) with before/after attribute diffing. Good fit for audit trails in admin panels or any app that needs to answer 'who changed what and when'.

- Automatic model event logging via the LogsActivity trait is well-designed — you control exactly which attributes are logged and dirty-tracked through LogOptions, avoiding the 'log everything and regret it' trap.

- Polymorphic subject/causer relationships mean you can attach any Eloquent model as the actor or target without schema changes, and eager-loading works normally.

- Activity buffering support lets you batch writes, which matters if you're logging high-frequency events and don't want N individual inserts per request.

- Actively maintained by Spatie with a proper UPGRADING.md, PHPStan at a reasonable level, and a test suite using Pest that covers the non-obvious edge cases like enum attributes and custom DB connections.

- Everything writes to a single activity_log table with no built-in partitioning or archiving strategy. On a busy app this table will balloon fast, and the cleanup command only does basic date-based pruning — no per-log-name retention policies out of the box.

- No async/queue support built in. Every log() call is a synchronous DB write in the request lifecycle. The buffer helps slightly but you're still on your own if you want to fire-and-forget via a queue.

- The properties column is a plain JSON blob, which makes querying specific property values awkward in MySQL and painful in anything that needs indexed searches on logged data.

- Custom causer resolution is documented but the default resolver assumes the standard Auth guard. Multi-guard or multi-tenant apps where the 'user' could be one of several model types require non-trivial wiring that the docs underexplain.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
5,847
Forks
744
Language
PHP
License
MIT
Last commit
2 Jun 2026

// nearby

If laravel-activitylog isn't quite it.

All repos →