damienharper/doctrine-audit-bundle
doctrine/dbal) or Doctrine ORM (via doctrine/orm).
spatie/laravel-activitylog may be more suitable.prePersist, preUpdate, preRemove), aligning with Laravel’s event system but requiring custom event listeners for seamless integration.Auth::user()) or middleware.orm.xml or annotations).audit_entry table (customizable).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Doctrine vs. Eloquent | High | Evaluate if Doctrine is a hard requirement or if Eloquent alternatives exist. |
| Event Listener Conflicts | Medium | Ensure no duplicate event handlers (Doctrine vs. Laravel’s Model::observers). |
| Performance Overhead | Medium | Test with high-write workloads; consider batch logging or async processing. |
| Schema Management | Low | Use Doctrine Migrations or Laravel Migrations with Doctrine schema tool. |
| Custom Metadata | Low | Extend via listeners (e.g., inject Auth::user() into audit logs). |
laravel-doctrine/orm).composer require damienharper/auditor-bundle doctrine/orm doctrine/dbal
config/bundles.php (Symfony-style; Laravel may need service provider)./**
* @Auditor\Audit
*/
class User {}
AuditorListener to inject Laravel-specific data (e.g., Auth::user()).audit_entry table.CREATE TABLE audit_entry (
id INT AUTO_INCREMENT PRIMARY KEY,
entity_class VARCHAR(255) NOT NULL,
entity_id INT NOT NULL,
action VARCHAR(10) NOT NULL, -- 'U' (update), 'I' (insert), 'D' (delete)
timestamp DATETIME NOT NULL,
user_id INT, -- Custom field for Laravel auth
old_data JSON,
new_data JSON,
INDEX (entity_class, entity_id, action)
);
| Component | Compatibility Notes |
|---|---|
| Laravel 10+ | Tested with Symfony 6.4+; Laravel’s Symfony components should align. |
| Doctrine ORM | Requires DoctrineBundle (if using Symfony) or manual setup in Laravel. |
| Eloquent | No native support; requires Doctrine ORM layer or event proxies. |
| Database | Supports MySQL, PostgreSQL, SQLite (via Doctrine). |
| Caching | Audit logs are not cached; may need read replicas for heavy queries. |
LogEntry).User, Order, etc.).Auth).audit_entry.Auth or User model changes.php artisan audit:purge).audit_entry directly; mitigate with:
cursor() or offset/limit).How can I help you explore Laravel packages today?