finds.dev← search

// the find

spatie/laravel-activitylog

★ 5,847 · PHP · MIT · updated Jun 2026

Log activity inside your Laravel app

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.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →