PHPackages                             whendy/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. whendy/laravel-activitylog

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

whendy/laravel-activitylog
==========================

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

3.14.2(5y ago)02MITPHPPHP ^7.2

Since Jun 23Pushed 5y agoCompare

[ Source](https://github.com/whendy/laravel-activitylog)[ Packagist](https://packagist.org/packages/whendy/laravel-activitylog)[ Docs](https://github.com/spatie/activitylog)[ Fund](https://spatie.be/open-source/support-us)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/whendy-laravel-activitylog/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (98)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)[![GitHub Workflow Status](https://camo.githubusercontent.com/082636f62dcd5d12e52ebac7fa312c51f05121eb42ba4bac25789ac11aed7983/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d61637469766974796c6f672f72756e2d74657374733f6c6162656c3d7465737473)](https://camo.githubusercontent.com/082636f62dcd5d12e52ebac7fa312c51f05121eb42ba4bac25789ac11aed7983/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d61637469766974796c6f672f72756e2d74657374733f6c6162656c3d7465737473)[![Code coverage](https://camo.githubusercontent.com/9a2254157b26da36dd0c1d7aa7a27968683eb8862a83b84c539b13370ff24baf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370617469652f6c61726176656c2d61637469766974796c6f672f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/spatie/laravel-activitylog)[![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. The Package stores all activity in the `activity_log` table.

Here's a 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/v3/advanced-usage/logging-model-events).

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

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

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

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

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

Support us
----------

[](#support-us)

Learn how to create a package like this one, by watching our premium video course:

[![Laravel Package training](https://camo.githubusercontent.com/4c7f3720a29525e627f6004ee367e55def510e45d18e6bc974725812fa5cf257/68747470733a2f2f7370617469652e62652f6769746875622f7061636b6167652d747261696e696e672e6a7067)](https://laravelpackage.training)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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 activity log? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-activitylog/issues), we'll try to address it as soon as possible.

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

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

[](#installation)

You can install the package via composer:

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

The package will automatically register itself.

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 publishing the migration 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 [

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

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

    /*
     * If no log name is passed to the activity() helper
     * we use this default log name.
     */
    'default_log_name' => 'default',

    /*
     * You can specify an auth driver here that gets user models.
     * If this is null we'll use the default Laravel auth driver.
     */
    'default_auth_driver' => null,

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

    /*
     * This model will be used to log activity.
     * It should be implements the Spatie\Activitylog\Contracts\Activity interface
     * and extend Illuminate\Database\Eloquent\Model.
     */
    'activity_model' => \Spatie\Activitylog\Models\Activity::class,

    /*
     * This is the name of the table that will be created by the migration and
     * used by the Activity model shipped with this package.
     */
    'table_name' => 'activity_log',

     /*
      * This is the database connection that will be used by the migration and
      * the Activity model shipped with this package. In case it's not set
      * Laravel database.default will be used instead.
      */
    'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION'),
];
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes.

Upgrading
---------

[](#upgrading)

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

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/sebastiandedeyne)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~15 days

Total

94

Last Release

2184d ago

Major Versions

2.8.4 → 3.0.02018-10-16

v1.x-dev → 3.6.22019-07-16

3.13.0 → 4.0.0-rc.12020-03-23

3.14.0 → 4.0.0-rc.22020-03-23

3.14.1 → v4.x-dev2020-03-23

PHP version history (3 changes)0.0.1PHP ^7.0

3.0.0PHP ^7.1

3.3.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb8c50426cfb7a5be5c05880bbc5081fc920a65e523774630515fb51d37ded72?d=identicon)[whendy](/maintainers/whendy)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (216 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (153 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (17 commits)")[![ReeceM](https://avatars.githubusercontent.com/u/2767904?v=4)](https://github.com/ReeceM "ReeceM (10 commits)")[![akoSalman](https://avatars.githubusercontent.com/u/17239230?v=4)](https://github.com/akoSalman "akoSalman (8 commits)")[![leMaur](https://avatars.githubusercontent.com/u/2118799?v=4)](https://github.com/leMaur "leMaur (6 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (4 commits)")[![ragingdave](https://avatars.githubusercontent.com/u/1168344?v=4)](https://github.com/ragingdave "ragingdave (3 commits)")[![eduarguz](https://avatars.githubusercontent.com/u/14934055?v=4)](https://github.com/eduarguz "eduarguz (3 commits)")[![bradcis](https://avatars.githubusercontent.com/u/379175?v=4)](https://github.com/bradcis "bradcis (3 commits)")[![chrisrhymes](https://avatars.githubusercontent.com/u/4160546?v=4)](https://github.com/chrisrhymes "chrisrhymes (3 commits)")[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (3 commits)")[![leewillis77](https://avatars.githubusercontent.com/u/1097338?v=4)](https://github.com/leewillis77 "leewillis77 (2 commits)")[![blueclock](https://avatars.githubusercontent.com/u/586174?v=4)](https://github.com/blueclock "blueclock (2 commits)")[![dam1r89](https://avatars.githubusercontent.com/u/3540487?v=4)](https://github.com/dam1r89 "dam1r89 (2 commits)")[![drbyte](https://avatars.githubusercontent.com/u/404472?v=4)](https://github.com/drbyte "drbyte (2 commits)")[![hackel](https://avatars.githubusercontent.com/u/583677?v=4)](https://github.com/hackel "hackel (2 commits)")[![imrealashu](https://avatars.githubusercontent.com/u/3916999?v=4)](https://github.com/imrealashu "imrealashu (2 commits)")[![kapersoft](https://avatars.githubusercontent.com/u/13007854?v=4)](https://github.com/kapersoft "kapersoft (2 commits)")[![LasseRafn](https://avatars.githubusercontent.com/u/2689341?v=4)](https://github.com/LasseRafn "LasseRafn (2 commits)")

---

Tags

logspatielaraveluseractivity

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/whendy-laravel-activitylog/health.svg)](https://phpackages.com/packages/whendy-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)
