whatisgithub

What is laravel-activitylog?

spatie/laravel-activitylog — explained in plain English

Analysis updated 2026-06-26

5,834PHPAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

A Laravel package that automatically records what users and the system do in your app, storing an audit trail of who changed what and when in a database table.

Mindmap

mindmap
  root((activitylog))
    What it does
      Audit trail logging
      Auto model event capture
      Old and new value diffs
    Setup
      Composer install
      Database migration
      Optional config file
    Log Entry Fields
      Subject record
      Causer user
      Custom properties
    Querying
      Laravel model queries
      Filter by user
      Filter by subject
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add an audit log to your Laravel app so admins can see every change made to records, including the old and new values.

USE CASE 2

Automatically track when database records are created, updated, or deleted without adding logging code to every model.

USE CASE 3

Store custom context with each log entry, such as which user triggered the action and which record was affected.

USE CASE 4

Query your activity log to display a user's action history or build an admin audit dashboard.

What is it built with?

PHPLaravelComposerMySQL

How does it compare?

spatie/laravel-activitylogtijsverkoyen/csstoinlinestylesvimeo/psalm
Stars5,8345,8385,840
LanguagePHPPHPPHP
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires an existing Laravel app and running a database migration to create the activity_log table.

MIT License, use freely for any purpose including commercial projects, as long as you keep the copyright notice.

So what is it?

This is a PHP package for the Laravel web framework that records what users and the system do inside your application. It stores those records in a database table called activity_log. Think of it as an audit trail: who did what, when, and to which piece of data. You can log things manually with a single line of code. You can attach context to each log entry: which database record was affected (the subject), which user caused the action (the causer), and any additional custom properties you want to store. You can then query all logged activities using a standard Laravel model. The package can also log model events automatically. When a database record is created, updated, or deleted, the package notices and writes a log entry without you needing to add any extra code. For updates, it records both the old values and the new values, so you can see exactly what changed. This makes it useful for audit logging in applications where you need to track changes to records over time. Installation is done through Composer, the standard PHP package manager. After installing, you run a database migration command to create the activity_log table. There is also an optional configuration file you can publish if you want to adjust the package behavior, such as changing the format of the ID fields to match UUIDs instead of integers. Full documentation is hosted at spatie.be. The package is maintained by Spatie, a Belgian web development agency that publishes many open source Laravel packages. It is licensed under the MIT License.

Copy-paste prompts

Prompt 1
I want to add automatic audit logging to my Laravel app using spatie/laravel-activitylog. Show me how to install it and enable model event logging on my User and Post models.
Prompt 2
How do I log a custom activity in Laravel with spatie/laravel-activitylog, including the subject record, the causer user, and extra custom properties?
Prompt 3
Using laravel-activitylog, how do I query all activities for a specific user and display them in a table showing the action, the affected record, and the timestamp?
Prompt 4
How do I configure laravel-activitylog to use UUIDs instead of integer IDs for the activity_log table entries?

Frequently asked questions

What is laravel-activitylog?

A Laravel package that automatically records what users and the system do in your app, storing an audit trail of who changed what and when in a database table.

What language is laravel-activitylog written in?

Mainly PHP. The stack also includes PHP, Laravel, Composer.

What license does laravel-activitylog use?

MIT License, use freely for any purpose including commercial projects, as long as you keep the copyright notice.

How hard is laravel-activitylog to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is laravel-activitylog for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.