#[AuditableRequest]) aligns with modern PHP (8.0+) practices and Symfony’s ecosystem.spatie/laravel-audit-logs), but complements them by focusing on request-specific metadata.Attribute class in composer.json if not already present.KernelEvents::REQUEST), enabling customization via listeners.composer require dmp/audit-request-bundle
config/bundles.php (Symfony) or service provider (Laravel).#[AuditableRequest]:
#[AuditableRequest(referenceType: 'order', referenceIdentifier: 'order-123')]
public function createOrder(Request $request) { ... }
AuditRequestEvent) or override services.referenceIdentifier).pdo_* or mysql may be needed for storage.spatie/laravel-audit-logs (more mature, but broader scope).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Bundle not logging requests | Silent data loss | Add health checks (e.g., log a test audit). |
| Database connection fails | Audit records lost | Implement retry logic or dead-letter queue. |
| Attribute parsing errors | Runtime exceptions | Validate annotations in CI/CD. |
| Schema mismatches | Storage failures | Use migrations with rollback safety nets. |
| High latency in audit logging | Degraded request performance | Throttle or async logging. |
#[AuditableRequest].How can I help you explore Laravel packages today?