PHP code example of azaharizaman / nexus-compliance
1. Go to this page and download the library: Download azaharizaman/nexus-compliance 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-compliance example snippets
use Nexus\Compliance\Services\ComplianceManager;
// Activate a compliance scheme
$schemeId = $complianceManager->activateScheme(
tenantId: 'tenant-123',
schemeName: 'ISO14001',
configuration: [
'audit_frequency' => 'quarterly',
'enable_environmental_tracking' => true,
]
);
// Check if scheme is active
$isActive = $complianceManager->isSchemeActive('tenant-123', 'ISO14001');
// Get all active schemes
$activeSchemes = $complianceManager->getActiveSchemes('tenant-123');
// Deactivate a scheme
$complianceManager->deactivateScheme('tenant-123', 'ISO14001');
use Nexus\Compliance\Services\SodManager;
use Nexus\Compliance\ValueObjects\SeverityLevel;
// Create a SOD rule
$ruleId = $sodManager->createRule(
tenantId: 'tenant-123',
ruleName: 'Purchase Order Approval',
transactionType: 'purchase_order',
severityLevel: SeverityLevel::CRITICAL,
creatorRole: 'purchaser',
approverRole: 'manager'
);
// Validate a transaction
try {
$sodManager->validateTransaction(
tenantId: 'tenant-123',
transactionType: 'purchase_order',
creatorId: 'user-001',
approverId: 'user-002'
);
} catch (SodViolationException $e) {
// Handle violation
echo $e->getMessage();
}
// Get all violations
$violations = $sodManager->getViolations(
tenantId: 'tenant-123',
from: new DateTimeImmutable('2025-01-01'),
to: new DateTimeImmutable('2025-12-31')
);