Download the PHP package rasuvaeff/yii3-audit-log without Composer

On this page you can find all versions of the php package rasuvaeff/yii3-audit-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii3-audit-log

rasuvaeff/yii3-audit-log

Stable Version Total Downloads Build Static analysis Psalm Level PHP License Русская версия

Audit trail for Yii3 applications: who changed what and when, with sensitive value masking. Stateless core — bring your own writer (DB adapter lives in a separate package).

Using an AI coding assistant? llms.txt has a compact API reference you can use. Projects using the llm/skills Composer plugin also get this package's agent skill synced into .agents/skills/ automatically on install.

Requirements

Installation

Yii3 config-plugin

The package ships config/di.php and config/params.php via config-plugin. It wires AuditLogger, SensitiveValueMasker and AuditEventIdGeneratorInterface (to RandomHexIdGenerator), but intentionally does not bind AuditWriter or Psr\Clock\ClockInterface. Install exactly one writer adapter or bind AuditWriter in your application config:

Default params:

Usage

Event ids

Event ids are the primary key of the audit table, so their format is a choice, not an implementation detail:

Generator id When
RandomHexIdGenerator (default) 32 random hex characters anything; keeps the historical format
Uuid7IdGenerator UUIDv7 rendered as 32 hex characters large, growing audit tables

A random primary key scatters InnoDB inserts across pages (an audit table is append-only and only grows, so the fragmentation compounds), while a time-ordered one appends. It also sorts chronologically, which gives a cheap tie-breaker for events within the same second — occurred_at alone cannot order them.

Uuid7IdGenerator strips the dashes deliberately: 32 characters is the same width as the default format, so it drops into the existing VARCHAR(32) column of rasuvaeff/yii3-audit-log-db with no migration. It needs symfony/uid — a suggest, installed only if you use it:

Application definitions win over the package's, so this one line is the whole switch. Your own implementation of AuditEventIdGeneratorInterface (ULID, a project-wide id scheme, a fixed value in tests) binds the same way.

Switching the generator does not rewrite existing rows: old events keep their random ids, new ones are ordered. Both are 32 hex characters, so nothing downstream needs to change.

Basic logging

Implementing a writer

Sensitive value masking

System actor

Request metadata

API reference

AuditLogger

Method Description
__construct(writer, clock, masker?, skipEmptyChangeSets?, idGenerator?) Defaults: skip empty sets = true, id generator = RandomHexIdGenerator
log(actor, action, subject, changes, metadata?) Generic log
logCreate(actor, subject, changes, metadata?) action = 'create'
logChange(actor, subject, changes, metadata?) action = 'update'
logDelete(actor, subject, changes, metadata?) action = 'delete'

AuditEventIdGeneratorInterface

Implementation Produces
RandomHexIdGenerator (default) 32 hex characters, 128 random bits
Uuid7IdGenerator UUIDv7 as 32 hex characters (needs symfony/uid)

AuditActor

Method Description
::user(id, name?) User actor
::system() System actor (id = null)
getType() 'user', 'system', or custom
getId() ?string
getName() ?string
isSystem() bool

AuditSubject

Method Description
::of(type, id) Factory
getType() Resource type
getId() Resource ID

AuditChangeSet

Method Description
::fromArrays(old, new) Computes diff; only changed fields included
::empty() Empty change set
getChanges() list<AuditChange>
isEmpty() bool
count() Number of changes

AuditChange

Method Description
getField() Field name
getOldValue() mixed
getNewValue() mixed

SensitiveValueMasker

Method Description
__construct(sensitiveKeys?) Default: password, secret, token, api_key, credit_card
mask(array) Returns array with sensitive values replaced by ***
maskChangeSet(AuditChangeSet) Returns new AuditChangeSet with masked values

Security

Examples

See examples/ for complete usage examples.

Development

make test-coverage and make mutation bootstrap pcov inside the composer:2 container because the base image has no coverage driver.

License

BSD-3-Clause. See LICENSE.md.


All versions of yii3-audit-log with dependencies

PHP Build Version
Package Version
Requires php Version 8.3 - 8.5
psr/clock Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rasuvaeff/yii3-audit-log contains the following files

Loading the files please wait ...