- Can I use benmacha/audit-bundle in a Laravel project without Symfony?
- No, this bundle is designed for Symfony and relies heavily on Doctrine ORM, Symfony’s EventDispatcher, and Twig templates. Laravel’s Eloquent ORM and Blade templating system make direct integration difficult without significant customization or a wrapper layer. Consider Laravel-native alternatives like spatie/laravel-activitylog.
- What Laravel alternatives provide similar audit logging with rollback?
- For Laravel, consider packages like spatie/laravel-activitylog (simple auditing), owen-it/simple-audit (rollback support), or laravel-audit-log. These are built for Eloquent and avoid Symfony’s architectural dependencies. None offer a full web UI out-of-the-box like this bundle, but they’re easier to integrate.
- How do I configure benmacha/audit-bundle to track only specific Eloquent models?
- This bundle is not natively compatible with Eloquent, so you’d need to rewrite its entity listeners or use a Doctrine bridge. Even then, configuration relies on Symfony’s YAML format (e.g., `config/packages/audit.yaml`), which won’t work directly in Laravel. For Eloquent, use observer events or package-specific configuration files like `config/audit.php`.
- Does benmacha/audit-bundle support Laravel’s queue system for async processing?
- No, the bundle’s async processing is tied to Symfony’s Messenger component. To adapt it for Laravel, you’d need to replace Symfony’s async handlers with Laravel’s queue system (e.g., Horizon) and rewrite the batch processing logic. This adds significant complexity and isn’t recommended without a custom wrapper.
- Will this bundle work with Laravel’s middleware for security (e.g., gates, policies)?
- The bundle’s security features (RBAC) are built for Symfony’s Security component. Laravel’s gate/middleware system is incompatible without a full rewrite. You’d need to manually implement access control in Laravel’s `app/Policies` or middleware, which defeats the bundle’s built-in security integration.
- How do I install benmacha/audit-bundle in a Laravel project if I still want to try?
- Installation via Composer is straightforward (`composer require benmacha/audit-bundle`), but enabling it requires Symfony’s bundle system. You’d need to manually register the bundle in a Laravel service provider and bridge Symfony’s services (e.g., EventDispatcher) to Laravel’s equivalents. This is not a turnkey solution and may break on updates.
- Can I use the web interface or REST API in Laravel without Symfony’s Twig?
- No, the web UI and REST API rely on Symfony’s Twig templates and routing system. To use them in Laravel, you’d need to rewrite the controllers, routes, and templates to use Laravel’s Blade and route service provider. This is a major undertaking and not recommended for production without a dedicated wrapper package.
- What Laravel versions and PHP versions does benmacha/audit-bundle support?
- This bundle explicitly targets Symfony 5.4–7.x and PHP 7.4–8.4. Laravel compatibility is not guaranteed, and the package assumes Symfony’s architecture. For Laravel, ensure your PHP version matches (e.g., Laravel 9+ supports PHP 8.0+), but the bundle itself won’t work without Symfony’s ecosystem.
- How do I test benmacha/audit-bundle in a Laravel project before committing?
- Test in a sandbox environment by installing the bundle and attempting to bridge its core services (e.g., AuditService) to Laravel’s container. Mock Symfony dependencies (e.g., EventDispatcher) and verify basic audit logging works with Eloquent models. Use PHPUnit to test edge cases like rollbacks, but expect failures due to architectural mismatches.
- Is there a performance impact if I use benmacha/audit-bundle in Laravel with a Doctrine bridge?
- Yes, using a Doctrine bridge (e.g., doctrine/orm) alongside Eloquent adds overhead. The bundle’s async processing and batching are optimized for Symfony’s Messenger, which may not integrate cleanly with Laravel’s queue system. Benchmark in staging to assess latency, especially for high-traffic applications.