1. Go to this page and download the library: Download azaharizaman/nexus-audit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
azaharizaman / nexus-audit example snippets
use Nexus\Audit\Contracts\AuditEngineInterface;
use Nexus\Audit\ValueObjects\AuditLevel;
$auditEngine = app(AuditEngineInterface::class);
// Critical security event - blocks until written with hash chain
$recordId = $auditEngine->logSync(
tenantId: '01TENANT...',
recordType: 'user_role_assigned',
description: 'User John Doe assigned role: Administrator',
subjectType: 'User',
subjectId: '01USER...',
causerType: 'User',
causerId: '01ADMIN...',
properties: ['role_id' => '01ROLE...', 'role_name' => 'Administrator'],
level: AuditLevel::Critical
);