The DynamoDB Driver for the Laravel Auditing package allows you to store audit logs in DynamoDB instead of a traditional database. This package includes queue support so that audit writes don't block user requests, it can handle high volumes, and user operations can continue even if Dynamo is down.
Once you configure the Dynamo DB driver as outlined in the readme, you can make your models auditable using the Auditing package for Laravel:
use OwenIt\Auditing\Contracts\Auditable; class User extends Model implements Auditable{ use \OwenIt\Auditing\Auditable; // Your model code}
This package also includes the ability to query the audits in DynamoDB:
use InfinityPaul\LaravelDynamoDbAuditing\AuditQueryService; $auditService = app(AuditQueryService::class); // Get all audits with pagination$result = $auditService->getAllAudits( limit: 25, lastEvaluatedKey: null, filters: [ 'entity_type' => 'App\\Models\\Wallet', // Required for fast search 'entity_id' => '12345', // Required for fast search 'start_date' => '2024-01-01T00:00:00', // Optional date filtering 'end_date' => '2024-12-31T23:59:59', // Optional date filtering ]);
Main Features
- High Performance: Store audit logs in DynamoDB for better scalability
- Auto-scaling: DynamoDB handles scaling automatically
- TTL Support: Automatic cleanup of old audit logs
- Flexible Schema: NoSQL structure for varying audit data
- Query Service: Built-in service for querying audit logs
- Laravel Integration: Seamless integration with Laravel Auditing
- Queue Support: Optional queue processing for improved performance
💻 You can get started with this package on GitHub: laravel-dynamodb-auditing