PHPackages                             illusiard/auditlog - 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. illusiard/auditlog

ActiveYii2-extension[Logging &amp; Monitoring](/categories/logging)

illusiard/auditlog
==================

Audit log extension for Yii2

v1.1.0(3w ago)00MITPHPPHP ^8.5

Since Dec 19Pushed 3w agoCompare

[ Source](https://github.com/Illusiard/yii2-auditlog)[ Packagist](https://packagist.org/packages/illusiard/auditlog)[ RSS](/packages/illusiard-auditlog/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (3)Used By (0)

Yii2 Audit Log
==============

[](#yii2-audit-log)

Модуль логирования и аудита для Yii2-приложений.

Позволяет логировать:

- создание, изменение и удаление ActiveRecord-моделей;
- diff изменённых полей;
- произвольный контекст (route, IP, user-agent и т.д.);
- бизнес-события (через прямой вызов логгера).

Поддерживает подключение через **Behavior** и не требует наследования моделей.

---

Возможности
-----------

[](#возможности)

- ✅ Логирование `create / update / delete`
- ✅ Diff только изменённых полей
- ✅ Контекст выполнения (route, IP, user agent и т.д.)
- ✅ Автоматическое создание `entity_type` и `action`, если их нет
- ✅ Кэширование справочников
- ✅ Bootstrap-автоподключение
- ✅ Не зависит от имени компонента в конфиге
- ✅ Готов к использованию как Composer-пакет

---

Требования
----------

[](#требования)

- PHP 8.5+
- Yii 2.0.55+

Установка
---------

[](#установка)

```
composer require illusiard/yii2-auditlog
```

После установки модуль автоматически подключается через Bootstrap.

Однако для проверки и подтягивания пользователей, нужно добавить в конфиг с User-классом:

```
use illusiard\auditlog\components\AuditLogger;

[
    'components' => [
        'auditlog' => [
            'class' => AuditLogger::class,
            'userClass' => app\models\User::class,
        ]
    ],
]
```

---

Миграции
--------

[](#миграции)

```
php yii migrate --migrationPath=@illusiard/auditlog/migrations
```

---

Подключение AuditBehavior
-------------------------

[](#подключение-auditbehavior)

```
use illusiard\auditlog\components\AuditBehavior;

class Order extends ActiveRecord
{
    public function behaviors(): array
    {
        return [
            'audit' => [
                'class' => AuditBehavior::class,
                'entityTypeCode' => 'order',
            ],
        ];
    }
}
```

---

Контекст
--------

[](#контекст)

```
'context' => function () {
    return [
        'route' => Yii::$app->requestedRoute,
        'ip' => Yii::$app->request->userIP,
        'userAgent' => Yii::$app->request->userAgent,
    ];
},
```

---

Ручное логирование
------------------

[](#ручное-логирование)

```
use illusiard\auditlog\components\AuditLogger;

AuditLogger::getInstance()->log(
    entityTypeCode: 'order',
    entityId: 42,
    actionCode: 'publish',
    diff: null,
    context: ['reason' => 'manual publish']
);
```

---

Лицензия
--------

[](#лицензия)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance83

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~170 days

Total

2

Last Release

26d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.1

v1.1.0PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/514a2bdbd1dfc61512460d4026da34187fb5e20e69be3ada0a8594b593dd269a?d=identicon)[Illusiard](/maintainers/Illusiard)

---

Top Contributors

[![Illusiard](https://avatars.githubusercontent.com/u/27963611?v=4)](https://github.com/Illusiard "Illusiard (3 commits)")

### Embed Badge

![Health badge](/badges/illusiard-auditlog/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[bedezign/yii2-audit

Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.

202705.8k4](/packages/bedezign-yii2-audit)[mito/yii2-sentry

Yii 2 extension for Sentry

92382.0k](/packages/mito-yii2-sentry)[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3460.8k](/packages/lav45-yii2-activity-logger)[yii2mod/yii2-cron-log

Component for logging cron jobs

2328.5k1](/packages/yii2mod-yii2-cron-log)

PHPackages © 2026

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