Download the PHP package rasuvaeff/yii3-audit-log-db without Composer
On this page you can find all versions of the php package rasuvaeff/yii3-audit-log-db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii3-audit-log-db
rasuvaeff/yii3-audit-log-db
Database-backed AuditWriter for rasuvaeff/yii3-audit-log.
Persists audit events to any yiisoft/db-compatible database (SQLite, MySQL, PostgreSQL, etc.).
Using an AI coding assistant? llms.txt has a compact API reference you can use.
Requirements
- PHP 8.3+
rasuvaeff/yii3-audit-log^1.0yiisoft/db^2.0
Installation
Migration
Run the bundled migration to create the audit_log table:
The migration creates:
| Column | Type | Notes |
|---|---|---|
id |
VARCHAR(32) PK | 32-char hex from AuditLogger |
actor_type |
VARCHAR(32) | user / system |
actor_id |
VARCHAR(255) NULL | null for system actor |
actor_name |
VARCHAR(255) NULL | display name, optional |
action |
VARCHAR(64) | create / update / delete / custom |
subject_type |
VARCHAR(255) | entity type, e.g. order |
subject_id |
VARCHAR(255) | entity id |
changes |
TEXT | JSON array of {field, old, new} objects |
occurred_at |
VARCHAR(30) | Y-m-d H:i:s UTC |
request_id |
VARCHAR(255) NULL | from AuditMetadata |
ip |
VARCHAR(45) NULL | from AuditMetadata |
user_agent |
TEXT NULL | from AuditMetadata |
Indexes: (subject_type, subject_id, occurred_at), (actor_type, actor_id, occurred_at), (occurred_at).
Yii3 config-plugin
Install rasuvaeff/yii3-audit-log (core) and rasuvaeff/yii3-audit-log-db (adapter).
The adapter's config/di.php automatically binds AuditWriter to DbAuditWriter.
The core's config/di.php wires AuditLogger. You only need to bind ClockInterface
in your application config:
Custom table name via params:
Usage
Write via AuditLogger
Use directly
Security
DbAuditWritervalidates the table name against/^[A-Za-z_]\w*(\.[A-Za-z_]\w*)?$/— schema-qualified names likepublic.audit_logare allowed; arbitrary strings are rejected.- All event field values are passed as bound parameters via
yiisoft/db— no SQL injection risk. changesvalues are whateverAuditChangeSetcontains. ApplySensitiveValueMaskerinAuditLoggerbefore this writer runs (default in core DI).
Examples
See examples/ for runnable scripts.
Development
Or with Docker directly:
License
BSD-3-Clause. See LICENSE.md.
All versions of yii3-audit-log-db with dependencies
rasuvaeff/yii3-audit-log Version ^1.0
yiisoft/db Version ^2.0
yiisoft/db-migration Version ^2.0