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

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

hectordev15/activitylog
=======================

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

2.2(7y ago)021MITPHPPHP ^7.0

Since Sep 7Pushed 7y agoCompare

[ Source](https://github.com/HectorDev15/activitylog)[ Packagist](https://packagist.org/packages/hectordev15/activitylog)[ RSS](/packages/hectordev15-activitylog/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (5)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)[![Build Status](https://camo.githubusercontent.com/82c39a48f742c967a112b9b58075c955e90ffee92c58963ae463c2d8a980ec36/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f6c61726176656c2d61637469766974796c6f672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/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. 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 we highly appreciated you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

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

All postcards are published [on our website](https://spatie.be/en/opensource/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 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
```

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 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/sebastiandedeyne)
- [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

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~143 days

Total

4

Last Release

2737d ago

Major Versions

1.0.0 → v2.12018-02-03

### Community

Maintainers

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

---

Top Contributors

[![HectorDev15](https://avatars.githubusercontent.com/u/26526093?v=4)](https://github.com/HectorDev15 "HectorDev15 (4 commits)")[![rifkyekayama](https://avatars.githubusercontent.com/u/10559132?v=4)](https://github.com/rifkyekayama "rifkyekayama (4 commits)")

---

Tags

logspatielaraveluseractivity

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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