Why I built another Audit Bundle for Symfony (and why you might need it)
When I started my latest Symfony project, I looked at the existing options for entity auditing. While there are some massive, well-established bundles out there, I ran into a few common headaches:
They felt "heavy": Often bringing in dependencies or UI components I didn't need.
Hard to customize: Trying to exclude specific fields or logic was surprisingly difficult.
No Integrity Checks: I had no easy way to verify if someone had manually tampered with the audit logs in the database.
So, I built AuditTrailBundle. Here is why it’s different:
Conditional Logging (The "Smart" Audit)
Sometimes you don’t want to log everything. Logging a last_login update every 5 minutes is a waste of storage. I added Expression Language support, allowing you to set rules so the bundle only logs changes if a specific condition is met or if a high-priority field actually changed.Data Integrity (The "Anti-Tamper" Check)
If an audit log is for compliance, you must know if a DBA (or a hacker) manually edited the logs to hide their tracks. This bundle includes an integrity check feature to verify that your history remains untouched and authentic.Performance-First Architecture
Many bundles slow down the main request because of how they handle entity relations. This bundle hooks into the onFlush event, ensuring the audit trail is part of the same database transaction. If your data rolls back, the audit rolls back. No orphaned logs, no performance lag.The "Split Transport" Advantage
One of the biggest fears with auditing is bloating the primary database. If your app has millions of transactions, your audit_log table can become a maintenance nightmare. I built a Split Transport feature so you aren't forced to save logs in the same place as your app data. You can route audit trails to a different database connection or an external transport, allowing you to scale without slowing down your high-traffic tables."Silent Collection" Tracking
Most lightweight bundles only track simple fields like strings or integers. When it comes to Many-to-Many or One-to-Many relations, they often fail to log exactly what happened—they just say the collection "changed." My bundle performs a Collection Diff, identifying precisely which IDs were added or removed from a collection.
Summary & Conclusion
I didn't build this bundle to replace the giants of the Symfony ecosystem, but to provide a modern, high-performance alternative for developers who need precision and integrity.
By focusing on conditional logging, split transports for scalability, and deep collection tracking, AuditTrailBundle gives you a "paper trail" that is both lightweight and enterprise-ready.
Check out the project on GitHub: https://github.com/rcsofttech85/AuditTrailBundle
I’m actively looking for feedback!If you find it useful, a Star ⭐ on GitHub would go a long way in helping the project grow!
Top comments (0)