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

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

amsrafid/laravel-activitylog
============================

Fast, easy and full customizable system for activity log.

1.0.1-beta(4y ago)060MITPHP

Since Apr 21Pushed 4y ago1 watchersCompare

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

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Laravel Activity Log
--------------------

[](#laravel-activity-log)

Simple but very powerful activity log package for laravel framework.

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

[](#installation)

To install this package, run this command to root directory of the project,

```
composer require amsrafid/laravel-activitylog
```

To publish config file of this package, run the following command,

```
php artisan vendor:publish --provider="Amsrafid\ActivityLog\ActivityLogServiceProvider"
```

*Note: Publishing service provider is optional.*

Get Started
-----------

[](#get-started)

Activity log has to be started after migrating log table. To make migration, hit the command bellow to the terminal,

```
php artisan migrate
```

Basic Use
---------

[](#basic-use)

Activity Log is very easy to use. A trait named ***ActivityLogHandler*** is to be added to any model to activate logging. On the other hand log can be enabled manually by initiating ***Logging*** class. Auto logging system can be added as like bellow,

```
namespace App;

use Illuminate\Database\Eloquent\Model;
use Amsrafid\ActivityLog\Traits\ActivityLogHandler;

class MyModel extends Model
{
    use ActivityLogHandler;

    // Optionals
    protected $log_name = "Log name";

    protected $description = "Log description";

    protected $ignore_fields = [
        // if any fields that being ignored to be logged
    ];

    protected $ignore_log = [
        // if any logging mode is to be ignored in (insert, update, delete, forceDelete)
    ];
}
```

Manual logging system is added bellow,

```
$myModel = MyModel::find(1);
$myModel->data = 'value';
$log = new Logging($myModel, 'update'); // model instance, mode -> [insert, update, delete, forceDelete]
$log->start();
```

OR

```
// Insertion operation
$myModel = new MyModel;
$myModel->data = 'value';
$myModel->save();

// Create new Activity Log
$log = new Logging(MyModel::class, 'insert');   // model name, mode -> [insert, update, delete, forceDelete]
$log->property([
    'new' => $myModel->toArray()
]);
$log->logName('Save my model');
$log->description('My model log has been created manually.');
$log->primaryId($myModel->id);
$log->start();
```

Here, Property can set by using `setProperty(array new, array old)` method. Where, 2 arguments can be performed to set new and old property of model. Here, default is an empty array for both.

*Note: Clear configuration cache to active configuration file. Otherwise, log may not be created.*

Barrier
-------

[](#barrier)

Logging can be paused at any time and to be proceed by using `paused` and `proceed` static method respectively.

```
$myModel = new MyModel;
$myModel->data = 'value 1'; // Log created
$myModel->save();

Logging::paused();  // Logging become paused

$myModel->data = 'value 2'; // Log not created
$myModel->save();

Logging::proceed(); // Logging proceed again

$myModel->data = 'value 3'; // Log created
$myModel->save();
```

*Note: Log barrier can be checked by `isPaused` static method.*

Parsing of log
--------------

[](#parsing-of-log)

Log can be parsed by using `\Amsrafid\ActivityLog\Models\ActivityLog\ActivityLog::class` that extends with `\Illuminate\Database\Eloquent\Model`. So, ActivityLog::class acts same as a regular model. Here, `properties` property returns an `array` to better use.

```
$set = ActivityLog::latest()->first();

echo $set->properties['new']['description'];
```

Log cleaning up
---------------

[](#log-cleaning-up)

Log can be deleted when a lot of activity has been recorded. To solve this problem, custom artisan command `clear:log` can help. It can operate when run the command bellow to the command window,

```
php artisan clear:log
```

OR

```
php artisan clear:log --day=7
```

OR

```
php artisan clear:log --date=2021-03-19
```

Here, option `--date` denotes the date before log will be deleted and `--day` to the number of day(s) before log will be cleared. Option ***day*** will not be applicable when ***date*** is given.

To operate cleaning automatically, a schedule can be created to console Kernel like bellow,

```
// ~/app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
   $schedule->command('clear:log')->daily();
}
```

*Note: Data will be deleted the day(s) before the value of the key `clean_log_before_days` given into config file when `--date` or `--day` option is not given.*

Authors
-------

[](#authors)

*Initial development* - ***A. M. Sadman Rafid***

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within Laravel Activity Log, please send an e-mail to *A. M. Sadman Rafid* via . All security vulnerabilities will be promptly addressed.

License
-------

[](#license)

The Laravel Activity Log is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~41 days

Total

2

Last Release

1804d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57731032?v=4)[A. M. Sadman Rafid](/maintainers/amsrafid)[@amsrafid](https://github.com/amsrafid)

---

Top Contributors

[![amsrafid](https://avatars.githubusercontent.com/u/57731032?v=4)](https://github.com/amsrafid "amsrafid (40 commits)")

---

Tags

activity-logactivity-loggereasylaravelloggingpackagephpplugin

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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