PHPackages                             azaharizaman/nexus-compliance - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. azaharizaman/nexus-compliance

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

azaharizaman/nexus-compliance
=============================

Operational compliance engine for enforcing business rules, SOD (Segregation of Duties), and compliance scheme requirements

v0.1.0-alpha1(1mo ago)022MITPHPPHP ^8.3

Since May 5Pushed 1mo agoCompare

[ Source](https://github.com/azaharizaman/nexus-compliance)[ Packagist](https://packagist.org/packages/azaharizaman/nexus-compliance)[ RSS](/packages/azaharizaman-nexus-compliance/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (2)

Nexus\\Compliance
=================

[](#nexuscompliance)

Operational compliance engine for enforcing business rules, SOD (Segregation of Duties), and compliance scheme requirements (ISO 14001, SOX, GDPR, etc.).

Overview
--------

[](#overview)

The Compliance package provides a framework-agnostic engine for managing compliance schemes and enforcing Segregation of Duties (SOD) rules across business transactions. It is designed to integrate with various ERP modules to ensure regulatory compliance and internal controls.

Features
--------

[](#features)

- **Compliance Scheme Management**: Activate, deactivate, and configure compliance schemes (ISO 14001, SOX, GDPR, HIPAA, PCI\_DSS)
- **SOD Rule Engine**: Define and enforce segregation of duties rules
- **Violation Tracking**: Log and monitor compliance violations
- **Configuration Auditing**: Validate required features and settings
- **Multi-Severity Levels**: Critical, High, Medium, Low
- **Framework-Agnostic**: Pure PHP with no Laravel dependencies

Installation
------------

[](#installation)

```
composer require azaharizaman/nexus-compliance
```

Architecture
------------

[](#architecture)

This package follows the Nexus architecture principles:

- **Framework-Agnostic**: No Laravel dependencies in core services
- **Contract-Driven**: All external dependencies defined via interfaces
- **Value Objects**: Immutable objects for domain concepts (SeverityLevel)
- **Repository Pattern**: Persistence abstraction via repository interfaces

### Package Structure

[](#package-structure)

```
packages/Compliance/
├── composer.json
├── LICENSE
├── README.md
└── src/
    ├── Contracts/                    # Interfaces
    │   ├── ComplianceManagerInterface.php
    │   ├── ComplianceSchemeInterface.php
    │   ├── ComplianceSchemeRepositoryInterface.php
    │   ├── SodManagerInterface.php
    │   ├── SodRuleInterface.php
    │   ├── SodRuleRepositoryInterface.php
    │   ├── SodViolationInterface.php
    │   └── SodViolationRepositoryInterface.php
    ├── Services/                     # Business logic
    │   ├── ComplianceManager.php
    │   └── SodManager.php
    ├── ValueObjects/                 # Immutable domain objects
    │   └── SeverityLevel.php
    └── Exceptions/                   # Domain exceptions
        ├── DuplicateRuleException.php
        ├── InvalidSchemeException.php
        ├── RuleNotFoundException.php
        ├── SchemeAlreadyActiveException.php
        ├── SchemeNotFoundException.php
        └── SodViolationException.php

```

Usage
-----

[](#usage)

### Compliance Scheme Management

[](#compliance-scheme-management)

```
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');
```

### SOD Rule Management

[](#sod-rule-management)

```
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')
);
```

Supported Compliance Schemes
----------------------------

[](#supported-compliance-schemes)

- **ISO14001**: Environmental Management System
- **SOX**: Sarbanes-Oxley Act (financial controls)
- **GDPR**: General Data Protection Regulation
- **HIPAA**: Health Insurance Portability and Accountability Act
- **PCI\_DSS**: Payment Card Industry Data Security Standard

Severity Levels
---------------

[](#severity-levels)

```
use Nexus\Compliance\ValueObjects\SeverityLevel;

SeverityLevel::CRITICAL;  // Priority: 4, Requires immediate action
SeverityLevel::HIGH;      // Priority: 3, Requires immediate action
SeverityLevel::MEDIUM;    // Priority: 2
SeverityLevel::LOW;       // Priority: 1
```

Integration with Applications
-----------------------------

[](#integration-with-applications)

This package defines contracts that must be implemented by the consuming application:

1. **Repository Implementations**: Implement all repository interfaces with Eloquent models
2. **Entity Implementations**: Implement all entity interfaces
3. **Database Migrations**: Create required tables in application layer
4. **Service Provider Bindings**: Bind interfaces to implementations in IoC container

### Required Tables (Application Layer)

[](#required-tables-application-layer)

```
-- Compliance schemes
compliance_schemes (id, tenant_id, scheme_name, is_active, activated_at, configuration, created_at, updated_at)

-- SOD rules
sod_rules (id, tenant_id, rule_name, transaction_type, severity_level, creator_role, approver_role, is_active, created_at, updated_at)

-- SOD violations
sod_violations (id, tenant_id, rule_id, transaction_id, transaction_type, creator_id, approver_id, violated_at, created_at)
```

Dependencies
------------

[](#dependencies)

- **PHP**: ^8.3
- **psr/log**: ^3.0 (for logging interface)

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
composer test
```

### Code Style

[](#code-style)

This package follows PSR-12 coding standards.

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) file for details.

Contributing
------------

[](#contributing)

Contributions are welcome! Please follow the Nexus architecture principles:

1. Keep the package framework-agnostic
2. Define all dependencies via interfaces
3. Use immutable Value Objects for domain concepts
4. Place all business logic in services
5. No database access or migrations in this package

Documentation
-------------

[](#documentation)

Comprehensive documentation is available in the `docs/` directory:

- **[Getting Started Guide](docs/getting-started.md)** - Quick start guide with basic setup
- **[API Reference](docs/api-reference.md)** - Complete API documentation for all interfaces and services
- **[Integration Guide](docs/integration-guide.md)** - Laravel and Symfony integration examples
- **[Basic Usage Examples](docs/examples/basic-usage.php)** - Simple use cases
- **[Advanced Usage Examples](docs/examples/advanced-usage.php)** - Complex scenarios

### Additional Resources

[](#additional-resources)

- **[Requirements](REQUIREMENTS.md)** - Detailed requirements traceability (62 requirements)
- **[Implementation Summary](IMPLEMENTATION_SUMMARY.md)** - Implementation progress and design decisions
- **[Test Suite Summary](TEST_SUITE_SUMMARY.md)** - Test coverage and testing strategy
- **[Valuation Matrix](VALUATION_MATRIX.md)** - Package valuation and ROI analysis

Support
-------

[](#support)

For issues, questions, or contributions, please refer to the main Nexus monorepo documentation.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance93

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

36d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/117408?v=4)[Azahari Zaman](/maintainers/azaharizaman)[@azaharizaman](https://github.com/azaharizaman)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/azaharizaman-nexus-compliance/health.svg)

```
[![Health](https://phpackages.com/badges/azaharizaman-nexus-compliance/health.svg)](https://phpackages.com/packages/azaharizaman-nexus-compliance)
```

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

515135.1M619](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[phpro/soap-client

A general purpose SoapClient library

8955.9M52](/packages/phpro-soap-client)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k41](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

744284.3k34](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.9M199](/packages/illuminate-broadcasting)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
