PHPackages                             odilov-sh/laravel-audit-tm - 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. odilov-sh/laravel-audit-tm

ActiveLibrary

odilov-sh/laravel-audit-tm
==========================

Laravel Auditor Package

34.8kPHP

Since Dec 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/odilov-sh/laravel-auditable-tm)[ Packagist](https://packagist.org/packages/odilov-sh/laravel-audit-tm)[ RSS](/packages/odilov-sh-laravel-audit-tm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

### About

[](#about)

This package provides a simple way to audit your Eloquent models. The package collects the following information:

- `service_id` - The ID of the service that is using the package
- `user_id` - The user who performed the action
- `event` - The event that was performed.
- `auditable_type` - The class name of the auditable model. Defaults to model class name. You can override `getAuditableClassName()` in your model.
- `auditable_id` - The ID of the auditable model. You can override `getAuditableId()` in your model.
- `old_values` - The old values of the auditable model
- `new_values` - The new values of the auditable model
- `tags` - Additional tags. You can override `getAuditableTags()` in your model.
- `url` - The URL of the request
- `ip_address` - The IP address of the request
- `user_agent` - The user agent of the request

If you use the `Astrotomic\Translatable\Translatable` trait, the package will also collect the translations of the auditable model, like `name_uz`, `title_uz` and so on.

### Installation

[](#installation)

```
composer require odilov-sh/laravel-audit-tm
```

### Publishing

[](#publishing)

```
php artisan vendor:publish --provider="OdilovSh\LaravelAuditTm\AuditTmServiceProvider"
```

### Envirement variables

[](#envirement-variables)

Your .env file must have the following variables:

```
AUTH_SERVICE_ID=1111
AUDIT_TM_SECRET_KEY="your secret key"
AUDIT_TM_ENABLED=true // if false, audit will not be sent
AUDIT_TM_BASE_URL="audit receiver base url"
```

### Usage

[](#usage)

```
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{

    use OdilovSh\LaravelAuditTm\Traits\Auditable;

}
```

The Auditable trait will automatically send data to audit server on `updated`, `created` and `deleted` events. In other cases, you must send data manually. Manually send data might be like this:

```
// Manually send data to audit server

use OdilovSh\LaravelAuditTm\AuditSender;

$data = [];
$data['event'] = 'changeStatus'; // Event name
$data['auditable_type'] = 'App\Models\Product'; // The name of the class being audited
$data['auditable_id'] = 123; // The id of the model being audited

// Old values before changing
$data['old_values'] = [
    'status' => 'active'
];

// New values after changing
$data['new_values'] = [
    'status' => 'inactive'
];

(new AuditSender($data))->send();
```

### Queue

[](#queue)

You can use queue job to send auditing data to audit server. In this case, you will not wait sending request to audit server and getting response. All of processes will be done in background. To use queue, first you must configure queue settings in Laravel. Then you just need add new configs to env file

```
AUDIT_TM_QUEUE_IS_ENABLED=true
AUDIT_TM_ON_QUEUE=default
```

### Notes

[](#notes)

This package uses `OdilovSh\LaravelAuditTm\Resolvers\UserIdResolver` to resolve the user id. You can change the resolver by changing the `user_id_resolver` in the `audit-tm` config file. As well you can set `false` this configuration. In this case `user_id` value will not be sent.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity20

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/92efeb5b89501e0b28beab3d111c1a763c21355ca3af9cb813724f134c32db11?d=identicon)[Shukurullo](/maintainers/Shukurullo)

---

Top Contributors

[![odilov-sh](https://avatars.githubusercontent.com/u/52707367?v=4)](https://github.com/odilov-sh "odilov-sh (16 commits)")

### Embed Badge

![Health badge](/badges/odilov-sh-laravel-audit-tm/health.svg)

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

PHPackages © 2026

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