Laravel Packages

A DynamoDB Driver for the Laravel Auditing Package

Published
A DynamoDB Driver for the Laravel Auditing Package image

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

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Email Sending and Testing for Laravel in One Account image

Email Sending and Testing for Laravel in One Account

Read article
Decide with Jev: Tie Every AI Check to the Exact Draft image

Decide with Jev: Tie Every AI Check to the Exact Draft

Read article
PIE 1.5 Changes PHP Extension Installs in CI image

PIE 1.5 Changes PHP Extension Installs in CI

Read article
Delete Expired Sessions in Laravel With a Scheduled Command image

Delete Expired Sessions in Laravel With a Scheduled Command

Read article
Pollora: Run WordPress Inside a Laravel Application image

Pollora: Run WordPress Inside a Laravel Application

Read article
Scheduled Session Garbage Collection in Laravel 13.39 image

Scheduled Session Garbage Collection in Laravel 13.39

Read article