kricha/doctrine-audit-bundle
A Symfony bundle that adds automatic audit trails to Doctrine entities. It captures insert, update, and delete operations, stores configurable change history and metadata, and helps you track who changed what and when without manual logging.
Architecture fit — poor for a Laravel/Eloquent stack. The package is a Symfony bundle, not a Laravel package. It hooks into Doctrine ORM lifecycle events (onFlush, postPersist, postUpdate, postRemove) via event subscribers and ships Symfony-specific wiring: a Bundle class registered in config/bundles.php, a DependencyInjection extension, a Configuration tree, and console commands. Laravel has no bundle-registration model and its default ORM is Eloquent, which emits a different event surface. As-is, the package cannot be composer required into a standard Laravel app and "just work."
Integration feasibility — conditional and high-effort. It is only viable if the target application already runs Doctrine ORM inside Laravel (e.g., via laravel-doctrine/orm). Even then, the Symfony container plumbing must be replaced with a Laravel service provider that registers the audit event subscriber on the Doctrine EventManager, binds the Auditor, and translates the bundle's YAML/XML config into Laravel config. The realistic path is extracting the core auditing logic (auditor, audit reader, audit table schema) rather than consuming the bundle wholesale — effectively a fork or re-implementation.
Technical risk — high.
Key questions for the team:
owen-it/laravel-auditing or spatie/laravel-activitylog for Eloquent; a Doctrine-native subscriber for Doctrine)?Stack fit. Two distinct scenarios must be resolved before planning:
laravel-doctrine/orm): Feasible via extraction. Register the bundle's audit subscriber manually on the Doctrine EventManager in an AppServiceProvider, bind the auditor as a singleton, and publish the audit schema as a Laravel migration instead of relying on the bundle's console commands.Migration path (if Doctrine is confirmed).
Configuration options (audited entities, global ignore list, table prefix) to a config/audit.php.Compatibility. Verify PHP 8.1/8.2/8.3 and Doctrine ORM/DBAL majors against the bundle's composer constraints. Expect to widen or patch constraints; treat Doctrine ORM 3.x support as an unknown until proven by a spike. Check database dialect support (MySQL/Postgres) and JSON/JSONB column handling for before/after payloads.
Sequencing.
Maintenance. No upstream activity since 2022. If adopted, we inherit full maintenance: security patching, Doctrine upgrade tracking, and bug fixes. Budget for a fork and a named internal owner; without that, the package is a liability rather than an asset.
Support. No vendor, no community, no dependents to lean on for troubleshooting. Incident response relies entirely on internal Doctrine expertise.
Scaling. The onFlush listener adds work to every persisting transaction, including computing field-level diffs. In high-write systems this can become a throughput bottleneck. Mitigations: async audit writes via queue, partitioned/append-only audit tables, retention and archival policies, and sampling or scoping to only sensitive entities. Plan capacity based on write volume × audited entities, not on the package's benchmarks (there are none).
Failure modes.
EntityManager, or if entities are excluded by misconfiguration.Ramp-up. The team must learn Symfony bundle conventions, Doctrine lifecycle events, and unit-of-work semantics. Expect a moderate learning curve and a one-to-two-week onboarding for the integrating engineer, plus additional time to build confidence in audit correctness (audit logs are only valuable if provably complete and accurate).
TPM recommendation. Treat this package as a reference implementation, not a dependency. The Laravel/Doctrine mismatch, staleness, and zero-adoption profile make direct adoption high-risk. Run a short spike to extract the audit-listener pattern into an in-house subscriber (for Doctrine stacks) or select a maintained Eloquent-native auditing package (for standard Laravel), and gate any adoption on a confirmed internal maintenance owner.
How can I help you explore Laravel packages today?