PHPackages                             joshbrw/laravel-audit-logging - 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. joshbrw/laravel-audit-logging

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

joshbrw/laravel-audit-logging
=============================

Fully translatable Audit Logging in Laravel.

v0.1.2(8y ago)23.4kMITPHPPHP ^7.0

Since Jul 4Pushed 8y agoCompare

[ Source](https://github.com/joshbrw/laravel-audit-logging)[ Packagist](https://packagist.org/packages/joshbrw/laravel-audit-logging)[ RSS](/packages/joshbrw-laravel-audit-logging/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

Laravel Audit Logging
=====================

[](#laravel-audit-logging)

A simple, easy-to-use audit logging system with translation at the heart. Uses UUIDs for easy dataset merging and management.

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

[](#installation)

1. Add `Joshbrw\AuditLogging\AuditLoggingServiceProviders,` under the `providers` key in `config/app.php`.
2. Add `'Audit' => Joshbrw\AuditLogging\Facades\Audit::class,` under the `aliases` key in `config/app.php` to register the Facade
3. Run `php artisan vendor:publish --provider="Joshbrw\\AuditLogging\\AuditLoggingServiceProvider" ` - this will publish the migration(s) to your top-level `database/migrations` directory.
4. Run `php artisan migrate` to run the migration(s) provided with this package.
5. On each of your Eloquent models that you wish to log, add the `Joshbrw\AuditLogging\Traits\Eloquent\Auditable` trait.

Usage
-----

[](#usage)

### Basic Attributes

[](#basic-attributes)

Every Audit Log item has two required attributes:

- `auditable_type` | `auditable_id` - The entity the audit relates to
- `message_key` - The translation key of the message

The option attributes are:

- `message_replacements` - An array of replacements that should be passed to the translator when displaying the audit log.
- `data` - Any array/object of data that you'd like to store against the Audit Log.
- `user_id` - The ID of the User performing the action being logged. **Supports Laravel's Auth and Sentinel by default, allows for custom adapters via the UserResolver**

### Using the Helper Methods &amp; Service

[](#using-the-helper-methods--service)

This library ships with an `audit()` method, with the following syntax:

```
    /**
     * Helper method for logging an audit entry.
     * @param mixed $entity The entity to create the log for
     * @param string $messageKey The key of the translatable message to use
     * @param array|null $messageReplacements Array of replacements for the message
     * @param array|null $data Any data to attribute to the audit log item
     * @return AuditLog Audit log instance
     */
    function audit($entity, string $messageKey, array $messageReplacements = null, array $data = null): AuditLog {
```

Which simply proxies through to the `Joshbrw\AuditLogging\AuditLogManager` service's `log()` method, which accepts the same parameters.

### Facade

[](#facade)

The package also ships with a Facade which can be used as `\Audit::` and proxies through to the `AuditLogManager`, such as `Audit::log()` and `Audit::translate()`.

### Fetching Audit Logs

[](#fetching-audit-logs)

You can use the `AuditLogRepository` to fetch Audit Logs for a specific Eloquent Model:

1. Ensure that the entity is using the `Auditable` trait.
2. See the following code to learn how to fetch all Audit Logs for the model, in reverse chronological order:

```
$user = App\User::first();
$auditLogs = app(Joshbrw\AuditLogging\Repositories\AuditLogRepository::class)->getAllAuditLogs($user);
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

3

Last Release

3227d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/779766?v=4)[Josh Brown](/maintainers/joshbrw)[@joshbrw](https://github.com/joshbrw)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/joshbrw-laravel-audit-logging/health.svg)

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

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M220](/packages/backpack-crud)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[open-telemetry/opentelemetry-auto-laravel

OpenTelemetry auto-instrumentation for Laravel

592.4M8](/packages/open-telemetry-opentelemetry-auto-laravel)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14844.4k1](/packages/guanguans-laravel-exception-notify)[nightowl/agent

NightOwl monitoring agent — collects telemetry from laravel/nightwatch and writes to PostgreSQL

771.7k](/packages/nightowl-agent)

PHPackages © 2026

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