PHPackages                             aurorawebsoftware/logiaudit - 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. aurorawebsoftware/logiaudit

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

aurorawebsoftware/logiaudit
===========================

Laravel log and audit package

13.0.0(1mo ago)0214[4 PRs](https://github.com/AuroraWebSoftware/LogiAudit/pulls)MITPHPPHP ^8.3||^8.4CI passing

Since Mar 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/AuroraWebSoftware/LogiAudit)[ Packagist](https://packagist.org/packages/aurorawebsoftware/logiaudit)[ Docs](https://github.com/AuroraWebSoftware/LogiAudit)[ GitHub Sponsors](https://github.com/AuroraWebSoftware)[ RSS](/packages/aurorawebsoftware-logiaudit/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (26)Versions (25)Used By (0)

LogiAudit
=========

[](#logiaudit)

LogiAudit is a Laravel package designed for structured logging and audit trail with support for job-based log storage, pruning, and customizable log levels.

Features
--------

[](#features)

- **Queue-Based Logging**: Logs are stored asynchronously using Laravel jobs.
- **Contextual Logging**: Supports logging with model associations, trace IDs, tags, and additional metadata.
- **Automatic Pruning**: Logs marked as deletable can be automatically removed.
- **Monolog Integration**: Works seamlessly with Laravel's logging system.
- **IP Tracking**: Logs IP addresses for traceability.
- **Configurable Cleanup**: Define log retention periods.
- **Tag Filtering**: Tag your logs for easy filtering and categorization.
- **Audit Trail**: Automatically track model changes (create, update, delete) with old/new values.

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

[](#installation)

You can install the package via Composer:

```
composer require aurorawebsoftware/logiaudit
```

### Running Migrations

[](#running-migrations)

After installation, run the migration command to create the necessary database tables:

```
php artisan migrate
```

Log Usage
=========

[](#log-usage)

### Logging Events

[](#logging-events)

You can log messages using the provided `addLog` helper function:

```
addLog('info', 'User logged in', [
    'model_id' => $user->id,
    'model_type' => get_class($user),
    'trace_id' => Str::uuid(),
    'tag' => 'auth',
    'context' => ['role' => 'admin'],
    'ip_address' => request()->ip(),
    'deletable' => true,
    'delete_after_days' => 30,
]);
```

#### `addLog` Helper Function Details

[](#addlog-helper-function-details)

The `addLog` function allows for flexible logging with optional parameters:

- **`level` (string, required)**: Log level (e.g., `info`, `error`, `warning`).
- **`message` (string, required)**: The log message.
- **`options` (array, optional)**: Additional context for the log entry.
    - `model_id` (int, nullable): The ID of the related model (if applicable).
    - `model_type` (string, nullable): The model's class name.
    - `trace_id` (string, nullable): A unique identifier for tracing logs across multiple services.
    - `tag` (string, nullable): A tag for filtering and categorizing logs (e.g., `payment`, `auth`, `api`).
    - `context` (array, nullable): Any extra contextual data.
    - `ip_address` (string, nullable): The IP address of the request.
    - `deletable` (bool, default: `true`): Determines if the log can be pruned.
    - `delete_after_days` (int, nullable): Number of days before the log should be automatically deleted (if `deletable`is `true`).

### Using LogiAudit with Laravel's Logging System

[](#using-logiaudit-with-laravels-logging-system)

You can also log messages using Laravel's built-in logging channels:

```
use Illuminate\Support\Facades\Log;

Log::channel('logiaudit')->info('Custom log message', [
    'model_id' => 1,
    'model_type' => 'User',
    'trace_id' => Str::uuid(),
    'tag' => 'payment',
    'context' => ['key' => 'value'],
    'ip_address' => request()->ip(),
]);
```

To configure Laravel to use this handler, update `config/logging.php`:

```
'channels' => [
    'logiaudit' => [
        'driver' => 'custom',
        'via' => AuroraWebSoftware\LogiAudit\Logging\LogiAuditHandler::class,
    ],
],
```

Running the Log Pruning Command
-------------------------------

[](#running-the-log-pruning-command)

To remove logs marked as `deletable`, run the following command:

```
php artisan logs:prune
```

Alternatively, you can schedule this command in your `bootstrap/app.php` (Laravel 11+):

```
->withSchedule(function (Schedule $schedule) {
    $schedule->command('logs:prune')->daily();
})
```

History Usage
=============

[](#history-usage)

History Log is simple to use. When you add **LogiAuditTrait** to your model classes whose history you want to monitor, History Log will start to keep history for your model.

```
use AuroraWebSoftware\LogiAudit\Traits\LogiAuditTrait;

class Order extends Model
{
    use LogiAuditTrait;
}
```

If you want to exclude some columns from this, add this variable to your model class globally and write the column names as an array.

```
protected $excludedColumns = ['deleted_at', 'id'];
```

If you don't want to keep history in some model events, add the following variable. Both short (`create`) and full (`created`) forms are accepted. Currently, this version only keeps the history of create, update and delete events.

```
protected $excludedEvents = ['delete', 'create'];
```

### Example History Record

[](#example-history-record)

Idactiontablemodelmodel\_idcolumnold\_valuenew\_valueuser\_idip\_address1createdordersApp\\Models\\Order5\["order\_code","price","total\_price"\]null\[{"order\_code":"ABCD"},{"price":"30"},{"total\_price":"60"}\]2177.77.0.12updatedordersApp\\Models\\Order5\["price"\]\[{"price":"30"}\]\[{"price":"50"}\]2177.77.0.1Running the History Pruning Command
-----------------------------------

[](#running-the-history-pruning-command)

To delete old history records based on their `created_at` timestamp, you can run the following Artisan command:

```
php artisan history:prune {days}
```

Replace {days} with the number of days you want to retain. For example, to delete all history records older than 30 days:

```
php artisan history:prune 30
```

Customizing Queue Names
=======================

[](#customizing-queue-names)

By default, log and history jobs are queued using the `logiaudit` queue.

You can customize the queue names by editing your config or `.env` file:

Configuration File Setup
------------------------

[](#configuration-file-setup)

```
// config/logiaudit.php
return [
    'log_queue_name' => env('LOGIAUDIT_LOG_QUEUE_NAME', 'logiaudit'),
    'history_queue_name' => env('LOGIAUDIT_HISTORY_QUEUE_NAME', 'logiaudit'),
];
```

If there is no config you can publish

```
php artisan vendor:publish --tag=config
```

Environment File Setup
----------------------

[](#environment-file-setup)

For example, to change the queue name for logs and history, add the following to your `.env` file:

```
LOGIAUDIT_LOG_QUEUE_NAME=my_custom_log_queue
LOGIAUDIT_HISTORY_QUEUE_NAME=my_custom_history_queue
```

Important Note
--------------

[](#important-note)

If you change the queue names, make sure to run dedicated workers for the new queue names:

```
php artisan queue:work --queue=my_custom_log_queue
php artisan queue:work --queue=my_custom_history_queue
```

You can keep the workers running in the background using **supervisor** or **systemd**.

License
-------

[](#license)

The LogiAudit package is open-sourced software licensed under the MIT License.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 52.6% 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 ~42 days

Recently: every ~74 days

Total

11

Last Release

42d ago

Major Versions

1.0.3 → 11.0.02025-04-07

11.0.3 → 12.0.02026-03-02

12.0.0 → 13.0.02026-05-13

PHP version history (3 changes)1.0.0PHP ^8.3

1.0.2PHP ^8.2||^8.3

13.0.0PHP ^8.3||^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/794216?v=4)[EA](/maintainers/emreakay)[@emreakay](https://github.com/emreakay)

---

Top Contributors

[![emreakay](https://avatars.githubusercontent.com/u/794216?v=4)](https://github.com/emreakay "emreakay (20 commits)")[![mfarukdev](https://avatars.githubusercontent.com/u/83613682?v=4)](https://github.com/mfarukdev "mfarukdev (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

loglaravelAuditAuroraWebSoftwarelogiaudit

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aurorawebsoftware-logiaudit/health.svg)

```
[![Health](https://phpackages.com/badges/aurorawebsoftware-logiaudit/health.svg)](https://phpackages.com/packages/aurorawebsoftware-logiaudit)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

162476.0k](/packages/keepsuit-laravel-opentelemetry)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[spatie/laravel-error-share

Share your Laravel errors to Flare

431.3M5](/packages/spatie-laravel-error-share)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

43140.3k](/packages/harris21-laravel-fuse)

PHPackages © 2026

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