Skip to main content
Version: 4.x

auditor

The missing audit log library for PHP

Latest Stable Version License Total Downloads

What is auditor?

auditor is a PHP library that provides an easy and standardized way to collect audit logs. It is designed to track changes made to your entities and persist them as audit trails.

Key Features

  • 📝 Automatic change tracking — Captures inserts, updates, and deletes automatically
  • 👤 User attribution — Records who made the changes and their IP address
  • 🎯 Flexible configuration — Choose which entities and fields to audit
  • 🔐 Security controls — Define who can view audit logs
  • 🔌 Provider-based architecture — Storage and query layer are fully delegated to providers

Architecture Overview

The library is architected around two core concepts:

  1. Auditing Services — Responsible for collecting audit events when changes occur
  2. Storage Services — Responsible for persisting audit traces to the database

These services are implemented by Providers. Each provider handles a specific storage technology (Doctrine ORM, Eloquent, etc.).

Data Flow

  1. Entity Change → Your application modifies an entity via Doctrine
  2. DetectionAuditingService detects the change through Doctrine events
  3. ProcessingTransactionProcessor computes diffs and prepares audit data (with extra_data = null)
  4. Event → A LifecycleEvent is dispatched with the audit payload and the entity object
  5. Enrichment (optional) → Your listener(s) inspect the entity and populate extra_data in the payload
  6. PersistenceStorageService persists the audit entry to the database

Available Providers

ProviderPackageStorage technology
DoctrineProviderauditor-doctrine-providerDoctrine ORM / DBAL

Need a different backend? See Building a Custom Provider.

Database Support

Database support depends on the provider used. Via DoctrineProvider:

DatabaseSupport Level
MySQL✅ Full
MariaDB✅ Full
PostgreSQL✅ Full
SQLite✅ Full

NOTE

DoctrineProvider should work with any database supported by Doctrine DBAL, though only the above are actively tested.

Version Compatibility

VersionStatusRequirements
4.xActive development 🚀PHP >= 8.4, Symfony >= 8.0
3.xActive supportPHP >= 8.2, Symfony >= 5.4
2.xEnd of LifePHP >= 7.4, Symfony >= 4.4
1.xEnd of LifePHP >= 7.2, Symfony >= 3.4

License

This library is released under the MIT License.