spatie/laravel-activitylog

Database and Eloquent

Logs what users do in your app and can log Eloquent model events automatically, storing everything in an activity_log table.

The problem it solves

An audit trail of who changed what is tedious to build and keep consistent across models.

Install

composer require spatie/laravel-activitylog

Example

From the package README: log an activity with a subject, a causer and properties.

activity()
   ->performedOn($anEloquentModel)
   ->causedBy($user)
   ->withProperties(['customProperty' => 'customValue'])
   ->log('Look, I logged something');

$lastLoggedActivity = Activity::all()->last();
$lastLoggedActivity->subject; // the model
$lastLoggedActivity->causer;  // the user

Requirements and activity

Fetched from Packagist and GitHub on 2026-11-29. Constraints show what the package allows, not what its maintainers tested.

Latest stable5.1.5 (2026-11-13)
PHP^8.4
Laravel^12.0 || ^13.0
LicenseMIT
Downloads (Packagist, total)75,039,213
GitHub stars5,917
Last push2026-11-26
StatusNot marked abandoned

Strengths

  • Model event logging records old and new attribute values.

Limits to know

  • Activity rows grow over time; plan for cleanup (see the package docs).

Official links

Documentation · Packagist · GitHub

Write-up based on: github.com/spatie/laravel-activitylog#readme. Written from the official README and docs; not tested by Laravel Questions. All packages.

Our network