PHPackages                             azaharizaman/nexus-sales-operations - 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. [API Development](/categories/api)
4. /
5. azaharizaman/nexus-sales-operations

ActiveLibrary[API Development](/categories/api)

azaharizaman/nexus-sales-operations
===================================

Nexus SalesOperations Orchestrator - Order-to-Cash workflow coordination with progressive disclosure for SMB to Enterprise

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

Since May 5Pushed 1mo agoCompare

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

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

Nexus SalesOperations Orchestrator
==================================

[](#nexus-salesoperations-orchestrator)

**Framework-Agnostic Order-to-Cash Workflow Coordination**

[![PHP Version](https://camo.githubusercontent.com/ef0054230522e542bc1f908ac005c6c75888dea255bac910f9015e12095e31d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e332d626c7565)](https://www.php.net/)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

Overview
--------

[](#overview)

`Nexus\SalesOperations` orchestrates the complete **Order-to-Cash (O2C)** cycle, coordinating workflows across Sales, Receivable, Inventory, and Warehouse domains. Designed with **Progressive Disclosure** to serve businesses from small startups to large enterprises.

---

Progressive Disclosure Philosophy
---------------------------------

[](#progressive-disclosure-philosophy)

This orchestrator scales with your business needs:

### Tier 1: Essential (Small Business)

[](#tier-1-essential-small-business)

- Quote → Order conversion
- Simple order confirmation
- Basic fulfillment tracking
- Direct invoicing

### Tier 2: Growth (Mid-Market)

[](#tier-2-growth-mid-market)

- Credit limit enforcement
- Multi-warehouse allocation
- Partial shipment handling
- Commission calculations

### Tier 3: Enterprise (Large Corporation)

[](#tier-3-enterprise-large-corporation)

- Multi-currency with rate locking
- Revenue recognition (IFRS 15/ASC 606)
- Advanced pricing rules
- Complete audit trail
- Approval workflows

---

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

[](#architecture)

```
src/
├── Contracts/           # Orchestrator interfaces (dependency inversion)
│   ├── QuotationInterface.php
│   ├── SalesOrderInterface.php
│   ├── CustomerInterface.php
│   ├── InvoiceInterface.php
│   ├── CreditManagerInterface.php
│   └── ...
├── Coordinators/        # Stateless traffic cops
│   ├── QuotationToOrderCoordinator.php
│   ├── OrderFulfillmentCoordinator.php
│   ├── CreditCheckCoordinator.php
│   └── ...
├── Workflows/           # Stateful long-running processes
│   ├── OrderToCashWorkflow.php
│   ├── SplitShipmentWorkflow.php
│   └── ...
├── Services/            # Pure business calculations
│   ├── MarginCalculator.php
│   ├── CommissionCalculator.php
│   ├── RevenueRecognitionService.php
│   └── ...
├── Listeners/           # Event reactors
│   ├── OnOrderConfirmedReserveStock.php
│   ├── OnShipmentCreatedGenerateInvoice.php
│   └── ...
├── Rules/               # Validation constraints
│   ├── CreditLimitRule.php
│   ├── StockAvailabilityRule.php
│   └── ...
├── DataProviders/       # Cross-package data aggregation
│   ├── OrderContextProvider.php
│   └── ...
├── DTOs/                # Strict data contracts
│   ├── CreateOrderRequest.php
│   ├── FulfillmentRequest.php
│   └── ...
├── Enums/               # Type-safe enumerations
│   ├── OrderStatus.php
│   ├── FulfillmentStatus.php
│   └── ...
└── Exceptions/          # Domain-specific errors
    ├── CreditLimitExceededException.php
    ├── InsufficientStockException.php
    └── ...

```

---

Core Components
---------------

[](#core-components)

### Coordinators

[](#coordinators)

#### 1. QuotationToOrderCoordinator

[](#1-quotationtoordercoordinator)

Converts quotations to confirmed sales orders.

```
use Nexus\SalesOperations\Coordinators\QuotationToOrderCoordinator;
use Nexus\SalesOperations\DTOs\ConvertQuotationRequest;

$coordinator = $container->get(QuotationToOrderCoordinator::class);

$result = $coordinator->convertToOrder(new ConvertQuotationRequest(
    quotationId: 'quote-001',
    confirmedBy: 'user-123',
    notes: 'Customer confirmed via email',
    overrides: [
        'payment_terms' => 'NET_30',
    ]
));

if ($result->success) {
    echo "Order created: {$result->orderId}";
}
```

#### 2. OrderFulfillmentCoordinator

[](#2-orderfulfillmentcoordinator)

Coordinates order fulfillment across inventory and warehouse.

```
use Nexus\SalesOperations\Coordinators\OrderFulfillmentCoordinator;
use Nexus\SalesOperations\DTOs\FulfillmentRequest;

$coordinator = $container->get(OrderFulfillmentCoordinator::class);

$result = $coordinator->fulfill(new FulfillmentRequest(
    orderId: 'order-001',
    warehouseId: 'wh-001',
    lines: [
        ['product_id' => 'prod-001', 'quantity' => 10],
        ['product_id' => 'prod-002', 'quantity' => 5],
    ],
    shippedBy: 'user-123',
    trackingNumber: 'TRK-123456',
));

echo "Shipment created: {$result->shipmentId}";
echo "Invoice generated: {$result->invoiceId}";
```

#### 3. CreditCheckCoordinator

[](#3-creditcheckcoordinator)

Enforces credit limits before order confirmation.

```
use Nexus\SalesOperations\Coordinators\CreditCheckCoordinator;

$coordinator = $container->get(CreditCheckCoordinator::class);

$check = $coordinator->checkCredit(
    customerId: 'customer-001',
    orderAmount: 5000.00,
    currency: 'USD'
);

if ($check->approved) {
    echo "Credit approved. Available: {$check->availableCredit}";
} else {
    echo "Credit denied: {$check->reason}";
    // Place order on credit hold
}
```

### Workflows

[](#workflows)

#### OrderToCashWorkflow

[](#ordertocashworkflow)

Complete O2C lifecycle management.

```
use Nexus\SalesOperations\Workflows\OrderToCashWorkflow;
use Nexus\SalesOperations\DTOs\OrderToCashRequest;

$workflow = $container->get(OrderToCashWorkflow::class);

$result = $workflow->execute(new OrderToCashRequest(
    tenantId: 'tenant-001',
    customerId: 'customer-001',
    lines: [
        ['product_id' => 'prod-001', 'quantity' => 100, 'unit_price' => 50.00],
    ],
    paymentTerms: 'NET_30',
    requestedBy: 'user-001',
));

// Workflow handles:
// 1. Credit check
// 2. Stock reservation
// 3. Order confirmation
// 4. Fulfillment
// 5. Invoicing
// 6. Payment tracking
// 7. Commission calculation
```

### Services

[](#services)

#### MarginCalculator

[](#margincalculator)

```
use Nexus\SalesOperations\Services\MarginCalculator;

$calculator = $container->get(MarginCalculator::class);

$analysis = $calculator->analyze(
    orderLines: $order->getLines(),
    costBasis: 'weighted_average',  // or 'fifo', 'standard'
    includeLandedCost: true,
);

echo "Gross Margin: {$analysis->grossMarginPercent}%";
echo "Net Margin: {$analysis->netMarginPercent}%";
echo "Total Profit: {$analysis->totalProfit}";
```

#### CommissionCalculator

[](#commissioncalculator)

```
use Nexus\SalesOperations\Services\CommissionCalculator;

$calculator = $container->get(CommissionCalculator::class);

$commission = $calculator->calculate(
    orderId: 'order-001',
    salespersonId: 'sales-001',
    basis: 'gross_profit',  // or 'revenue', 'quantity'
);

echo "Commission earned: {$commission->amount}";
echo "Rate applied: {$commission->rate}%";
```

### Rules

[](#rules)

#### CreditLimitRule

[](#creditlimitrule)

```
use Nexus\SalesOperations\Rules\CreditLimitRule;

$rule = $container->get(CreditLimitRule::class);

$result = $rule->validate(new CreditCheckRequest(
    customerId: 'customer-001',
    orderAmount: 10000.00,
));

if (!$result->passed) {
    throw new CreditLimitExceededException($result->message);
}
```

---

Event-Driven Integration
------------------------

[](#event-driven-integration)

### Events Published

[](#events-published)

EventWhen Fired`QuotationCreatedEvent`New quotation submitted`QuotationAcceptedEvent`Customer accepts quote`OrderCreatedEvent`Order created from quote`OrderConfirmedEvent`Order confirmed for fulfillment`OrderCancelledEvent`Order cancelled`ShipmentCreatedEvent`Goods shipped`InvoiceGeneratedEvent`Invoice created`PaymentReceivedEvent`Payment applied`CommissionCalculatedEvent`Sales comp calculated### Event Listeners

[](#event-listeners)

Listens ToListenerAction`OrderConfirmedEvent``ReserveStockListener`Reserve inventory`OrderConfirmedEvent``CheckCreditListener`Verify credit limit`ShipmentCreatedEvent``GenerateInvoiceListener`Create invoice`ShipmentCreatedEvent``UpdateInventoryListener`Deduct stock`PaymentReceivedEvent``ReleaseCreditHoldListener`Free up credit`PaymentReceivedEvent``CalculateCommissionListener`Compute sales comp---

Progressive Disclosure Matrix
-----------------------------

[](#progressive-disclosure-matrix)

FeatureTier 1 (SMB)Tier 2 (Mid)Tier 3 (Enterprise)Quote → Order✅✅✅Basic Fulfillment✅✅✅Direct Invoicing✅✅✅Credit Limit Check-✅✅Partial Shipments-✅✅Multi-Warehouse-✅✅Commission Calc-✅✅Multi-Currency--✅Revenue Recognition--✅Advanced Pricing--✅Approval Workflows--✅Full Audit Trail--✅---

Contracts (Interfaces)
----------------------

[](#contracts-interfaces)

All interfaces are defined in `Contracts/` following the **Orchestrator Interface Segregation Pattern**. Adapters implement these interfaces using atomic packages.

### Core Interfaces

[](#core-interfaces)

```
interface CustomerInterface
{
    public function getId(): string;
    public function getName(): string;
    public function getCreditLimit(): float;
    public function getPaymentTerms(): string;
    public function getCurrency(): string;
}

interface QuotationInterface
{
    public function getId(): string;
    public function getCustomerId(): string;
    public function getStatus(): string;
    public function getTotal(): float;
    public function getLines(): array;
    public function getValidUntil(): \DateTimeImmutable;
}

interface SalesOrderInterface
{
    public function getId(): string;
    public function getOrderNumber(): string;
    public function getCustomerId(): string;
    public function getStatus(): string;
    public function getTotal(): float;
    public function getLines(): array;
    public function getPaymentTerms(): string;
}

interface InvoiceInterface
{
    public function getId(): string;
    public function getInvoiceNumber(): string;
    public function getOrderId(): string;
    public function getTotal(): float;
    public function getBalanceDue(): float;
    public function getStatus(): string;
}

interface CreditManagerInterface
{
    public function checkCreditLimit(string $customerId, float $amount): bool;
    public function getAvailableCredit(string $customerId): float;
    public function placeOnHold(string $orderId, string $reason): void;
    public function releaseHold(string $orderId): void;
}

interface StockReservationInterface
{
    public function reserve(string $orderId, string $productId, float $quantity): bool;
    public function release(string $orderId): void;
    public function getReservedQuantity(string $orderId, string $productId): float;
}

interface ShipmentInterface
{
    public function getId(): string;
    public function getOrderId(): string;
    public function getStatus(): string;
    public function getTrackingNumber(): ?string;
    public function getLines(): array;
}
```

---

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

[](#installation)

```
composer require azaharizaman/nexus-sales-operations
```

### Required Dependencies (via Adapters)

[](#required-dependencies-via-adapters)

PackagePurpose`Nexus\Sales`Sales orders, quotations`Nexus\Receivable`Invoicing, credit control`Nexus\Inventory`Stock management`Nexus\Warehouse`Shipping, staging`Nexus\Party`Customer management`Nexus\AuditLogger`Audit trail`Nexus\Notifier`Notifications---

Testing
-------

[](#testing)

```
# Run all tests
vendor/bin/phpunit orchestrators/SalesOperations/tests

# Run with coverage
vendor/bin/phpunit --coverage-html coverage orchestrators/SalesOperations/tests
```

---

License
-------

[](#license)

MIT License - See [LICENSE](LICENSE) file.

---

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

[](#documentation)

- [ARCHITECTURE.md](../../ARCHITECTURE.md) - System architecture
- [ORCHESTRATOR\_INTERFACE\_SEGREGATION.md](../../docs/ORCHESTRATOR_INTERFACE_SEGREGATION.md) - Interface pattern
- [CODING\_GUIDELINES.md](../../CODING_GUIDELINES.md) - Coding standards

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance93

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 (4 commits)")

---

Tags

invoicingsalesfulfillmentorchestratorquotationnexusorder-to-casho2c

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k86.9M2.2k](/packages/symfony-symfony)[symfony/mailer

Helps sending emails

1.6k394.6M1.3k](/packages/symfony-mailer)[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

1237.8M117](/packages/web-auth-webauthn-lib)[phpro/soap-client

A general purpose SoapClient library

8955.9M52](/packages/phpro-soap-client)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69534.4M144](/packages/algolia-algoliasearch-client-php)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

51090.8k2](/packages/web-auth-webauthn-framework)

PHPackages © 2026

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