PHPackages                             unisharp/laravel-audit-trail - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. unisharp/laravel-audit-trail

ActivePackage[Utility &amp; Helpers](/categories/utility)

unisharp/laravel-audit-trail
============================

Keep a change history for your models using laravel version 5.1.\*

41.3k1PHP

Since Nov 5Pushed 8y ago6 watchersCompare

[ Source](https://github.com/UniSharp/laravel-audit-trail)[ Packagist](https://packagist.org/packages/unisharp/laravel-audit-trail)[ RSS](/packages/unisharp-laravel-audit-trail/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Laravel Audit Trail
===================

[](#laravel-audit-trail)

### What is this package for?

[](#what-is-this-package-for)

- This package is for laravel 5.0/5.1, which helps you create your auditing logs into your database.

Setup
-----

[](#setup)

1. In `/config/app.php`, add the following to `providers`:

    ```
    Unisharp\AuditTrail\AuditServiceProvider::class,

    ```

    and the following to `aliases`:

    ```
    'Audit' => Unisharp\AuditTrail\Facades\Audit::class,

    ```
2. Run `php artisan vendor:publish`.
3. Run `php artisan migrate`.

Usage
-----

[](#usage)

> All your logs will be recorded in 'audit\_trails' table.

- You need to add a trait to the model you're going to audit.

    ```
    class User extends Eloquent
    {
      use \Unisharp\AuditTrail\Auditable;

      protected $table = 'users';

      protected $hidden = ['password'];

      protected $fillable = ['username', 'email', 'password'];
    }
    ```
- In any place you want to audit your user logs

    ```
    $User->log($action, $comment = null, $subject = null, $subject_id = null)
    ```

    ```
    Audit::log($action, $comment = null)
    ```

    ```
    $User->log('log in', 'the action is approved')
    ```

    ```
    Audit::log('log in', 'the action is approved')
    ```

    - $User is an Eloquent Object here.
    - The second, third parameters are optional.
    - You could put your modified column and column id to `subject` and `subject_id` parameters.
- Other usages

    - You can get your model logs by:

        ```
        $User->getLogs();
        ```
    - Get all the logs by single user by using:

        ```
        Audit::getByUserId($user_id)
        ```
    - As time grows, logs would be outdated. You may clean them by:

        ```
        $User->cleanLogs()
        ```

License
-------

[](#license)

This package is licensed under [MIT license](https://unisharp.mit-license.org/).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.4% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/49773ea5050ec1d004a506cc1e11be08d6e87339120b5d223b8921e3f671153c?d=identicon)[g0110280](/maintainers/g0110280)

![](https://avatars.githubusercontent.com/u/181350?v=4)[Youchen Lee (isacl)](/maintainers/youchenlee)[@youchenlee](https://github.com/youchenlee)

---

Top Contributors

[![albertcht](https://avatars.githubusercontent.com/u/9117929?v=4)](https://github.com/albertcht "albertcht (21 commits)")[![CatheCat](https://avatars.githubusercontent.com/u/14325344?v=4)](https://github.com/CatheCat "CatheCat (7 commits)")[![youchenlee](https://avatars.githubusercontent.com/u/181350?v=4)](https://github.com/youchenlee "youchenlee (1 commits)")

### Embed Badge

![Health badge](/badges/unisharp-laravel-audit-trail/health.svg)

```
[![Health](https://phpackages.com/badges/unisharp-laravel-audit-trail/health.svg)](https://phpackages.com/packages/unisharp-laravel-audit-trail)
```

###  Alternatives

[slowprog/composer-copy-file

Composer script copying your files after install

481.0M30](/packages/slowprog-composer-copy-file)[personnummer/personnummer

Validate Swedish social security numbers

34739.3k3](/packages/personnummer-personnummer)[contao-community-alliance/composer-client

The contao composer client.

2652.6k](/packages/contao-community-alliance-composer-client)

PHPackages © 2026

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