PHPackages                             ensi/laravel-auditing - 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. ensi/laravel-auditing

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

ensi/laravel-auditing
=====================

laravel auditing

0.4.6(3mo ago)431.5k↓23.2%4[1 issues](https://github.com/ensi-platform/laravel-auditing/issues)MITPHPPHP ^8.1CI passing

Since Jul 30Pushed 3mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (10)Versions (22)Used By (0)

Laravel Auditing
================

[](#laravel-auditing)

[![Latest Version on Packagist](https://camo.githubusercontent.com/440255ca963d4fa27ae390bba60ea994ec212cf27266961c191b4f2e3870f20f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e73692f6c61726176656c2d6175646974696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ensi/laravel-auditing)[![Tests](https://github.com/ensi-platform/laravel-auditing/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/ensi-platform/laravel-auditing/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/b3d146dcaf2a7a7e6e8df2ee4f0550633cb2acaa2edad692099b1f287564bffa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e73692f6c61726176656c2d6175646974696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ensi/laravel-auditing)

Opiniated fork of [owen-it/laravel-auditing](https://github.com/owen-it/laravel-auditing)

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

[](#installation)

You can install the package via composer:

```
composer require ensi/laravel-auditing
```

Publish the migrations with:

```
php artisan vendor:publish --provider="Ensi\LaravelAuditing\LaravelAuditingServiceProvider"
```

### Migrate from 0.2.x to 0.3.0

[](#migrate-from-02x-to-030)

1. Publish new migration `php artisan vendor:publish --provider="Ensi\LaravelAuditing\LaravelAuditingServiceProvider" --tag=migrations-0.3`
2. If the config `laravel-auditing.php` is published, then replace the `resolver.user`value with `Ensi\LaravelAuditing\Resolvers\UserResolver::class`

Version Compatibility
---------------------

[](#version-compatibility)

Laravel AuditingLaravelPHP^0.1.2^7.x || ^8.x^8.0^0.2.0^7.x || ^8.x^8.0^0.3.0^7.x || ^8.x^8.0^0.3.1^8.x || ^9.x^8.0^0.3.5^8.x || ^9.x || ^10.x || ^11.x^8.0^0.4.0^9.x || ^10.x || ^11.x^8.1Basic Usage
-----------

[](#basic-usage)

By default, no modification history is saved for models. To enable logging for a specific model, you need to add the `Support s Audit` trait and the `Auditable` interface to it

```
use Ensi\LaravelAuditing\Contracts\Auditable;
use Ensi\LaravelAuditing\SupportsAudit;

class Something extends Model implements Auditable {
    use SupportsAudit;
}
```

If we change the data of the child models from a logical point of view and want this change to take place under the parent model in the history, it is necessary to set the root entity (i.e. the model) in the transaction before changing the data. This is done through the `Transaction` facade or the manager `\\Ensi\\LaravelAuditing\\Transactions\\ExtendedTransactionManager`

```
DB::transaction(function () {
    Transaction::setRootEntity($rootModel);

    $relatedModel->save();
});
```

To add data to the history about who made the changes (a specific user, or, for example, a console command), again, you need to do this before changing the data, but through the `Subject` facade or the injection of `\\Ensi\\LaravelAuditing\\Resolvers\\SubjectManager`

```
Subject::attach($subject); // $subject - an object implementing Ensi\LaravelAuditing\Contracts
```

The subject does not unbind after the transaction is completed. It can be unlinked manually by calling the `Subject::detach()` method.

When processing http requests, you can set the subject in middleware. In console commands and handlers, event queues are reassigned during execution.

The subject can be any entity that supports the interface `\Ensi\LaravelAuditing\Contracts\Principal`. If the subject is an ongoing task, for example, importing from a file, then it can return the ID of the user who created the task in the `getUserIdentifier()` method, and return the name of the imported file as the name.

In the user model, the `getAuthIdentifier()` and `getUserIdentifier()` methods return the same identifier.

Also, unlike the original package, not only the changed fields are saved in the history, but also the complete state of the model object at the time of the change.

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

[](#contributing)

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

### Testing

[](#testing)

1. composer install
2. composer test

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

[](#security-vulnerabilities)

Please review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.

License
-------

[](#license)

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

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance73

Regular maintenance activity

Popularity34

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

20

Last Release

117d ago

PHP version history (2 changes)0.1.2PHP ^8.0

0.4.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8089373?v=4)[Наталия](/maintainers/MsNatali)[@MsNatali](https://github.com/MsNatali)

![](https://avatars.githubusercontent.com/u/7352966?v=4)[Andrey](/maintainers/dimionx)[@DimionX](https://github.com/DimionX)

---

Top Contributors

[![zix2](https://avatars.githubusercontent.com/u/51262118?v=4)](https://github.com/zix2 "zix2 (24 commits)")[![MsNatali](https://avatars.githubusercontent.com/u/8089373?v=4)](https://github.com/MsNatali "MsNatali (18 commits)")[![arrilot](https://avatars.githubusercontent.com/u/2826480?v=4)](https://github.com/arrilot "arrilot (17 commits)")[![LeraSt](https://avatars.githubusercontent.com/u/96006397?v=4)](https://github.com/LeraSt "LeraSt (6 commits)")[![valerialukinykh](https://avatars.githubusercontent.com/u/123940772?v=4)](https://github.com/valerialukinykh "valerialukinykh (3 commits)")[![vladksh](https://avatars.githubusercontent.com/u/84857010?v=4)](https://github.com/vladksh "vladksh (2 commits)")[![C0rTeZ13](https://avatars.githubusercontent.com/u/120840631?v=4)](https://github.com/C0rTeZ13 "C0rTeZ13 (2 commits)")[![DimionX](https://avatars.githubusercontent.com/u/7352966?v=4)](https://github.com/DimionX "DimionX (1 commits)")[![fedorf4](https://avatars.githubusercontent.com/u/79131391?v=4)](https://github.com/fedorf4 "fedorf4 (1 commits)")[![vadileo](https://avatars.githubusercontent.com/u/51167100?v=4)](https://github.com/vadileo "vadileo (1 commits)")[![koopaTro0pa](https://avatars.githubusercontent.com/u/60116849?v=4)](https://github.com/koopaTro0pa "koopaTro0pa (1 commits)")[![amlagoda](https://avatars.githubusercontent.com/u/49432167?v=4)](https://github.com/amlagoda "amlagoda (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ensi-laravel-auditing/health.svg)

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[hyn/multi-tenant

Run multiple websites using the same laravel installation while keeping tenant specific data separated for fully independant multi-domain setups.

2.6k1.1M9](/packages/hyn-multi-tenant)[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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