PHPackages                             azaharizaman/nexus-workflow - 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. [Framework](/categories/framework)
4. /
5. azaharizaman/nexus-workflow

ActiveLibrary[Framework](/categories/framework)

azaharizaman/nexus-workflow
===========================

Framework-agnostic workflow engine for Nexus ERP monorepo

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

Since May 5Pushed 1mo agoCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (4)

Nexus\\Workflow
===============

[](#nexusworkflow)

**Framework-agnostic workflow engine for Nexus ERP monorepo**

Overview
--------

[](#overview)

The Workflow package provides a powerful, flexible workflow engine that supports:

- **State Machine Management**: Define and execute finite state machines with guards and hooks
- **Task Management**: User task inbox with approval workflows
- **Conditional Routing**: Dynamic routing based on workflow data
- **Parallel Execution**: AND/OR gateways for complex approval flows
- **Multi-Approver Strategies**: Unison, majority, quorum, weighted, first-wins
- **Escalation &amp; SLA**: Automatic escalations and SLA breach tracking
- **Delegation**: User delegation with date ranges and chain limits
- **Compensation Logic**: Rollback activities in reverse order on failure
- **Approval Matrix**: Threshold-based routing configuration
- **Event-Driven Timers**: Scalable timer system for scheduled actions
- **Plugin Architecture**: Extensible activities, conditions, strategies, and triggers

Core Philosophy
---------------

[](#core-philosophy)

This package is **framework-agnostic**. It defines **WHAT** workflows need to do (the logic), not **HOW** they are persisted or implemented. All database operations, Laravel-specific features, and Eloquent models belong in the `apps/Atomy` application layer.

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

[](#architecture)

```
packages/Workflow/
├── src/
│   ├── Contracts/          # Interfaces defining all dependencies
│   ├── Core/               # Internal workflow engine (state machine, task engine, etc.)
│   ├── Services/           # Public API (WorkflowManager, TaskManager, etc.)
│   ├── ValueObjects/       # Immutable data structures
│   └── Exceptions/         # Domain-specific exceptions

```

Key Interfaces
--------------

[](#key-interfaces)

### Workflow &amp; State Management

[](#workflow--state-management)

- `WorkflowInterface` - Workflow instance representation
- `StateInterface` - Workflow state representation
- `TransitionInterface` - State transition representation
- `WorkflowRepositoryInterface` - Persistence contract

### Task Management

[](#task-management)

- `TaskInterface` - User task representation
- `TaskRepositoryInterface` - Task persistence contract
- `InboxInterface` - Task inbox query interface

### Execution &amp; Control

[](#execution--control)

- `StateEngineInterface` - State transition execution
- `TaskEngineInterface` - Task creation and completion
- `ConditionEvaluatorInterface` - Condition expression evaluation
- `ApprovalStrategyInterface` - Multi-approver logic

### Automation

[](#automation)

- `EscalationInterface` - Escalation rule processing
- `SlaTrackerInterface` - SLA monitoring and breach detection
- `TimerInterface` - Timer management
- `DelegationInterface` - User delegation handling

### Extensibility

[](#extensibility)

- `ActivityInterface` - Plugin activities (email, webhook, etc.)
- `TriggerInterface` - Workflow triggers (webhook, schedule, event)
- `StorageInterface` - Custom storage backends

Value Objects
-------------

[](#value-objects)

- `State` - Workflow state definition
- `Transition` - State transition definition
- `TaskAction` - Task action (approve, reject, request changes)
- `SlaStatus` - SLA tracking status (on\_track, at\_risk, breached)
- `ApprovalStrategy` - Multi-approver strategy enum
- `EscalationRule` - Escalation configuration
- `WorkflowData` - Typed workflow data container
- `ConditionExpression` - Parsed condition expression

Services (Public API)
---------------------

[](#services-public-api)

### WorkflowManager

[](#workflowmanager)

Primary entry point for workflow operations:

- `instantiate(definition, data)` - Create new workflow instance
- `apply(workflow, transition)` - Execute state transition
- `can(workflow, transition)` - Check if transition is allowed
- `history(workflow)` - Retrieve state change history

### TaskManager

[](#taskmanager)

Task operations:

- `createTask(workflow, state, assignee)` - Create user task
- `completeTask(task, action, comment)` - Complete task with action
- `delegate(user, delegatee, dateRange)` - Delegate tasks

### InboxService

[](#inboxservice)

Task inbox queries:

- `forUser(userId)` - Get tasks for specific user
- `pending()` - Filter pending tasks
- `filter(criteria)` - Apply filters (workflow type, priority, due date)

### EscalationService

[](#escalationservice)

Escalation management:

- `processEscalations()` - Process overdue tasks
- `defineRule(state, threshold, action)` - Configure escalation rules

### SlaService

[](#slaservice)

SLA tracking:

- `trackSla(workflow)` - Monitor SLA status
- `getSlaStatus(workflow)` - Get current SLA status
- `getBreaches()` - Retrieve breached workflows

### DelegationService

[](#delegationservice)

Delegation management:

- `createDelegation(delegator, delegatee, dateRange)` - Create delegation
- `revokeDelegation(delegation)` - Cancel delegation
- `getDelegationChain(user)` - Get delegation chain

Exceptions
----------

[](#exceptions)

- `WorkflowNotFoundException` - Workflow not found
- `InvalidTransitionException` - Transition not allowed from current state
- `TaskNotFoundException` - Task not found
- `UnauthorizedTaskActionException` - User not authorized to act on task
- `InvalidWorkflowDefinitionException` - Invalid workflow structure
- `GuardConditionFailedException` - Transition guard condition failed
- `SlaBreachException` - SLA deadline breached
- `DelegationChainExceededException` - Delegation chain too deep (&gt;3 levels)
- `CircularDependencyException` - Circular state dependency detected
- `InvalidConditionExpressionException` - Invalid condition syntax

Usage Example (Conceptual)
--------------------------

[](#usage-example-conceptual)

```
use Nexus\\Workflow\\Services\\WorkflowManager;

// Inject via constructor
public function __construct(
    private readonly WorkflowManager $workflowManager
) {}

// Check if transition is allowed
if ($this->workflowManager->can($workflow, 'approve')) {
    // Execute transition
    $this->workflowManager->apply($workflow, 'approve');
}

// Get history
$history = $this->workflowManager->history($workflow);
```

Implementation
--------------

[](#implementation)

The consuming application (`apps/Atomy`) must provide:

1. **Eloquent Models** implementing workflow interfaces
2. **Repository Classes** implementing repository interfaces
3. **Database Migrations** for all workflow tables
4. **Service Provider** binding interfaces to implementations
5. **HasWorkflow Trait** for Eloquent models
6. **API Routes** exposing workflow functionality

See `apps/Atomy/app/` for concrete implementations.

Requirements Coverage
---------------------

[](#requirements-coverage)

This package fulfills requirements:

- ARC-WOR-0405 to ARC-WOR-0414 (Architectural requirements)
- BUS-WOR-0415 to BUS-WOR-0424 (Business requirements)
- FUN-WOR-0425 to FUN-WOR-0541 (Functional requirements)
- PERF-WOR-0543 to PERF-WOR-0547 (Performance requirements)
- SEC-WOR-0548 to SEC-WOR-0553 (Security requirements)
- REL-WOR-0554 to REL-WOR-0558 (Reliability requirements)
- SCL-WOR-0559 to SCL-WOR-0562 (Scalability requirements)
- MAINT-WOR-0563 to MAINT-WOR-0566 (Maintainability requirements)
- USE-WOR-0567 to USE-WOR-0584 (User stories)

📖 Documentation
---------------

[](#-documentation)

### Package Documentation

[](#package-documentation)

- [Getting Started Guide](docs/getting-started.md)
- [API Reference](docs/api-reference.md)
- [Integration Guide](docs/integration-guide.md)
- [Examples](docs/examples/)

### Additional Resources

[](#additional-resources)

- `IMPLEMENTATION_SUMMARY.md` - Implementation progress
- `REQUIREMENTS.md` - Requirements
- `TEST_SUITE_SUMMARY.md` - Tests
- `VALUATION_MATRIX.md` - Valuation

License
-------

[](#license)

MIT License - see LICENSE file for details

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance93

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 76.6% of commits — single point of failure

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)

---

Top Contributors

[![azaharizaman](https://avatars.githubusercontent.com/u/117408?v=4)](https://github.com/azaharizaman "azaharizaman (462 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (139 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M822](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[pinguo/php-msf

Pinguo Micro Service Framework For PHP

1.7k4.2k](/packages/pinguo-php-msf)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)

PHPackages © 2026

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