Download the PHP package azaharizaman/nexus-policy-engine without Composer
On this page you can find all versions of the php package azaharizaman/nexus-policy-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download azaharizaman/nexus-policy-engine
More information about azaharizaman/nexus-policy-engine
Files in azaharizaman/nexus-policy-engine
Package nexus-policy-engine
Short Description Deterministic policy evaluation for authorization and workflow decisions.
License MIT
Informations about the package nexus-policy-engine
Nexus\PolicyEngine
Overview
Nexus\PolicyEngine is a Layer 1 package that evaluates tenant-scoped policies with deterministic outcomes.
Version 1 supports:
- Authorization decisions
- Workflow decisions
- Threshold/limit runtime decisions (numeric comparator-based)
Architecture
- Layer 1 (pure PHP, framework-agnostic)
- Interface-first boundaries via
src/Contracts - Immutable domain/value objects
- Deterministic conflict resolution and default outcomes
Key Interfaces
Nexus\PolicyEngine\Contracts\PolicyEngineInterfaceNexus\PolicyEngine\Contracts\PolicyRegistryInterfaceNexus\PolicyEngine\Contracts\PolicyCompilerInterface(reserved for future compilation/caching use in v1)Nexus\PolicyEngine\Contracts\PolicyDefinitionDecoderInterface(JSON to typed domain policy)
Requirements Mapping
- Authorization policy evaluation (A)
- Workflow policy evaluation (B)
- Threshold policy runtime (C:
GT,GTE,LT,LTE,BETWEEN) - Stateless JSON policy decoding and domain validation
Multi-Layer Usage Pattern
- Layer 1 (
Nexus\PolicyEngine)- Owns typed policy model, evaluator, validator, and JSON decode contract/service.
- Remains stateless and framework-agnostic.
- Layer 2 (orchestrators)
- Coordinates when policy decode/evaluate is invoked in business workflows.
- Composes cross-package context before calling the engine.
- Layer 3 (adapters/apps)
- Provides storage-backed policy registries and transport concerns (HTTP/UI/DB).
- Admin UI and persistence adapters live here, not in Layer 1.
Installation
From monorepo root, ensure autoload is refreshed:
composer dump-autoload
Run package tests:
vendor/bin/phpunit -c packages/PolicyEngine/phpunit.xml
Usage Examples
1) Authorization policy evaluation
Use this when deciding if a subject can perform an action on a resource.
2) Workflow routing/escalation
Use workflow policies to drive approve/reject/escalate/route decisions.
3) Threshold runtime evaluation
Threshold policies support numeric comparators:
gt,gte,lt,lte,between
4) Decode policy JSON into typed domain model
This is useful when policies are authored/stored outside PHP and loaded by adapters.
License
MIT