rcsofttech / audit-trail-bundle
Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.
Package info
github.com/rcsofttech85/AuditTrailBundle
Type:symfony-bundle
pkg:composer/rcsofttech/audit-trail-bundle
Fund package maintenance!
Requires
- php: ^8.4
- composer-runtime-api: ^2.0
- ext-mbstring: *
- doctrine/doctrine-bundle: ^3.1
- doctrine/orm: ^3.6
- symfony/expression-language: ^7.4|^8.0
- symfony/framework-bundle: ^7.4|^8.0
- symfony/security-bundle: ^7.4|^8.0
- symfony/uid: ^7.4|^8.0
- symfony/validator: ^7.4|^8.0
- symfony/var-exporter: ^7.4|^8.0
- symfony/yaml: ^7.4|^8.0
Requires (Dev)
- dama/doctrine-test-bundle: ^8.6
- easycorp/easyadmin-bundle: ^5.0
- friendsofphp/php-cs-fixer: ^3.60
- infection/infection: ^0.32.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-symfony: *
- phpunit/phpunit: ^13.1
- spaze/phpstan-disallowed-calls: ^4.7
- symfony/http-client: ^7.4|^8.0
- symfony/messenger: ^7.4|^8.0
- symfony/phpunit-bridge: ^7.4|^8.0
Suggests
- easycorp/easyadmin-bundle: Required to use the provided AuditLogCrudController for a built-in dashboard.
- symfony/http-client: Required to enable the HTTP audit transport.
- symfony/messenger: Required to enable the queue transport and async database transport.
- dev-main
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.0
- v4.0.2
- v4.0.1
- v4.0.0
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.10.0
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.1
- v1.6.0
- v1.5.1
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.0.1
- v1.0.0
- dev-docs
- dev-deferred-lazy-collection-materialization
This package is auto-updated.
Last update: 2026-06-05 16:36:29 UTC
README
AuditTrailBundle records Doctrine ORM entity changes in Symfony applications. It captures changes during Doctrine flush, stores audit logs, supports multiple delivery transports, and provides tools for integrity verification, review, export, and recovery.
Documentation
Full documentation now lives on GitHub Pages:
- Current docs: AuditTrailBundle 4.x documentation
- Configuration: configuration reference
- Transports: database, async database, queue, HTTP, and chain
- Usage & AuditReader: attributes, context, events, and query API
- Operations: revert, CLI, exports, and serialization
- Upgrade & Architecture: upgrade guides and architecture notes
For older versions, use the README and docs from the matching GitHub tag unless archived public docs are added later.
Features
- Doctrine entity audit logs for create, update, delete, soft-delete, restore, access, and revert flows
- Split-phase architecture that avoids nested Doctrine
flush()calls - Database, async database, queue, HTTP, and chain-style delivery options
- PHP attributes for
#[Auditable],#[AuditCondition],#[AuditAccess], and#[Sensitive] - Sensitive data masking with
#[SensitiveParameter]and bundle-level sensitive fields - AuditReader API for history, filtering, diffs, changed fields, pagination, and existence checks
- EasyAdmin integration, Symfony profiler support, CLI commands, exports, and revert tooling
- HMAC signing for stored audit logs and transport payloads
- Extension points for voters, context contributors, transports, AI metadata, and revert handlers
Quick Start
Install
composer require rcsofttech/audit-trail-bundle
Optional packages depend on the features you enable:
composer require symfony/messenger # async database or queue transport composer require symfony/http-client # HTTP transport composer require easycorp/easyadmin-bundle # EasyAdmin dashboard
Prepare The Database
The database transport is enabled by default. Generate and run a Doctrine migration for the audit log table:
php bin/console make:migration php bin/console doctrine:migrations:migrate
Mark An Entity As Auditable
The example uses PHP 8.4 asymmetric property visibility (public private(set)) and constructor property promotion for normal entity fields. Keep the generated ID outside the constructor so callers cannot pass it accidentally.
<?php declare(strict_types=1); namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use Rcsofttech\AuditTrailBundle\Attribute\Auditable; #[ORM\Entity] #[Auditable(ignoredProperties: ['internalCode'])] class Product { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] public private(set) ?int $id = null; public function __construct( #[ORM\Column(length: 180)] public private(set) string $name, #[ORM\Column] public private(set) int $priceInCents, #[ORM\Column(length: 40, nullable: true)] public private(set) ?string $internalCode = null, ) { } }
Minimal Configuration
# config/packages/audit_trail.yaml audit_trail: enabled: true ignored_properties: ['updatedAt', 'updated_at'] retention_days: 365 transports: database: enabled: true async: false
Requirements
- PHP 8.4+
- Symfony 7.4 or 8.0
- Doctrine ORM 3.6+
- DoctrineBundle 3.1+
ext-mbstring
Links
- Packagist: rcsofttech/audit-trail-bundle
- Issues: GitHub issue tracker
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
License
MIT License.