PHPackages                             dmfaux/laravel-activitylog - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. dmfaux/laravel-activitylog

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

dmfaux/laravel-activitylog
==========================

A very simple activity logger to monitor the users of your website or application

1.10.2(9y ago)1245MITPHPPHP ^7.0

Since Jun 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/dmfaux/laravel-activitylog)[ Packagist](https://packagist.org/packages/dmfaux/laravel-activitylog)[ Docs](https://github.com/spatie/activitylog)[ RSS](/packages/dmfaux-laravel-activitylog/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (7)Versions (29)Used By (0)

Log activity inside your Laravel app
====================================

[](#log-activity-inside-your-laravel-app)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b101fa363a4770f9539c7ebc6eeee59e1524bfbc83cf89808020ac8d23ac9ac7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d61637469766974796c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-activitylog)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/82c39a48f742c967a112b9b58075c955e90ffee92c58963ae463c2d8a980ec36/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f6c61726176656c2d61637469766974796c6f672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/laravel-activitylog)[![SensioLabsInsight](https://camo.githubusercontent.com/58ce3daa98c5eb2b1e6301f711e8cf1a0175fa52271af68c18a6cfdb1b8be66f/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f32306133386464342d303661302d343031662d626435312d3164336630356663646666352e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/20a38dd4-06a0-401f-bd51-1d3f05fcdff5)[![Quality Score](https://camo.githubusercontent.com/30ed3128f1fd0d17d1f481192009cea4a5833431c63c9d7e1abe0e4f1345569d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f6c61726176656c2d61637469766974796c6f672e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/laravel-activitylog)[![StyleCI](https://camo.githubusercontent.com/c065ab47cc017b2a58232ec9eb542a87c9a566c1adaf44f8992da3f65d8ccc2b/68747470733a2f2f7374796c6563692e696f2f7265706f732f36313830323831382f736869656c64)](https://styleci.io/repos/61802818)[![Total Downloads](https://camo.githubusercontent.com/f0e5e9f5f0147bcc0ace895cd3b706de0b98c5349ff59a221fb8b6a5914da207/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d61637469766974796c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-activitylog)

The `spatie/laravel-activitylog` package provides easy to use functions to log the activities of the users of your app. It can also automatically log model events. All activity will be stored in the `activity_log` table.

Here's a litte demo of how you can use it:

```
activity()->log('Look, I logged something');
```

You can retrieve all activity using the `Spatie\Activitylog\Models\Activity` model.

```
Activity::all();
```

Here's a more advanced example:

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

$lastLoggedActivity = Activity::all()->last();

$lastLoggedActivity->subject; //returns an instance of an eloquent model
$lastLoggedActivity->causer; //returns an instance of your user model
$lastLoggedActivity->getExtraProperty('customProperty'); //returns 'customValue'
$lastLoggedActivity->description; //returns 'Look, I logged something'
```

Here's an example on [event logging](https://docs.spatie.be/laravel-activitylog/v1/advanced-usage/logging-model-events).

```
$newsItem->name = 'updated name';
$newsItem->save();

//updating the newsItem will cause an activity being logged
$activity = Activity::all()->last();

$activity->description; //returns 'updated'
$activity->subject; //returns the instance of NewsItem that was created
```

Calling `$activity->changes` will return this array:

```
[
   'attributes' => [
        'name' => 'updated name',
        'text' => 'Lorum',
    ],
    'old' => [
        'name' => 'original name',
        'text' => 'Lorum',
    ],
];
```

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Postcardware
------------

[](#postcardware)

You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment you are required to send us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

The best postcards will get published on the open source page on our website.

Documentation
-------------

[](#documentation)

You'll find the documentation on .

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the media library? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-medialibrary/issues), we'll try to address it as soon as possible.

If you've found a bug regarding security please mail  instead of using the issue tracker.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-activitylog
```

Next, you must install the service provider:

```
// config/app.php
'providers' => [
    ...
    Spatie\Activitylog\ActivitylogServiceProvider::class,
];
```

You can publish the migration with:

```
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="migrations"
```

*Note*: The default migration assumes you are using integers for your model IDs. If you are using UUIDs, or some other format, adjust the format of the subject\_id and causer\_id fields in the published migration before continuing.

After the migration has been published you can create the `activity_log` table by running the migrations:

```
php artisan migrate
```

You can optionally publish the config file with:

```
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [

    /**
     * When set to false, no activities will be saved to database.
     */
    'enabled' => env('ACTIVITY_LOGGER_ENABLED', true),

    /**
     * When running the clean-command all recording activites older than
     * the number of days specified here will be deleted.
     */
    'delete_records_older_than_days' => 365,

    /**
     * When not specifying a log name when logging activity
     * we'll using this log name.
     */
    'default_log_name' => 'default',

    /**
     * When set to true, the subject returns soft deleted models.
     */
     'subject_returns_soft_deleted_models' => false,

    /**
     * This model will be used to log activity. The only requirement is that
     * it should be or extend the Spatie\Activitylog\Models\Activity model.
     */
    'activity_model' => \Spatie\Activitylog\Models\Activity::class,
];
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [Sebastian De Deyne](https://github.com/sebdedeyne)
- [All Contributors](../../contributors)

About Spatie
------------

[](#about-spatie)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

23

Last Release

3485d ago

Major Versions

0.0.1 → 1.0.02016-06-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/142688137794a5797a0a6f372a5052680f8b934e0339543f37505afb35361a2a?d=identicon)[dmfaux](/maintainers/dmfaux)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (114 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (3 commits)")[![pmatseykanets](https://avatars.githubusercontent.com/u/779965?v=4)](https://github.com/pmatseykanets "pmatseykanets (2 commits)")[![blueclock](https://avatars.githubusercontent.com/u/586174?v=4)](https://github.com/blueclock "blueclock (2 commits)")[![gjreasoner](https://avatars.githubusercontent.com/u/3363867?v=4)](https://github.com/gjreasoner "gjreasoner (1 commits)")[![hackel](https://avatars.githubusercontent.com/u/583677?v=4)](https://github.com/hackel "hackel (1 commits)")[![irazasyed](https://avatars.githubusercontent.com/u/1915268?v=4)](https://github.com/irazasyed "irazasyed (1 commits)")[![jeroennoten](https://avatars.githubusercontent.com/u/4370753?v=4)](https://github.com/jeroennoten "jeroennoten (1 commits)")[![leewillis77](https://avatars.githubusercontent.com/u/1097338?v=4)](https://github.com/leewillis77 "leewillis77 (1 commits)")[![pabloguerrez](https://avatars.githubusercontent.com/u/22682624?v=4)](https://github.com/pabloguerrez "pabloguerrez (1 commits)")[![Thijmen](https://avatars.githubusercontent.com/u/383903?v=4)](https://github.com/Thijmen "Thijmen (1 commits)")[![a3020](https://avatars.githubusercontent.com/u/1431100?v=4)](https://github.com/a3020 "a3020 (1 commits)")[![wpouseele](https://avatars.githubusercontent.com/u/470182?v=4)](https://github.com/wpouseele "wpouseele (1 commits)")[![aguimaraes](https://avatars.githubusercontent.com/u/131234?v=4)](https://github.com/aguimaraes "aguimaraes (1 commits)")[![DarkyAngel](https://avatars.githubusercontent.com/u/59185104?v=4)](https://github.com/DarkyAngel "DarkyAngel (1 commits)")[![dmfaux](https://avatars.githubusercontent.com/u/4727445?v=4)](https://github.com/dmfaux "dmfaux (1 commits)")

---

Tags

logspatielaraveluseractivity

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dmfaux-laravel-activitylog/health.svg)

```
[![Health](https://phpackages.com/badges/dmfaux-laravel-activitylog/health.svg)](https://phpackages.com/packages/dmfaux-laravel-activitylog)
```

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
