PHPackages                             solidframe/modular - 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. solidframe/modular

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

solidframe/modular
==================

Modular monolith building blocks: module contracts, integration events, ACL, registry for SolidFrame

v0.1.0(3mo ago)02MITPHP ^8.2

Since Apr 14Compare

[ Source](https://github.com/solidframe/modular)[ Packagist](https://packagist.org/packages/solidframe/modular)[ RSS](/packages/solidframe-modular/feed)WikiDiscussions Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

SolidFrame Modular
==================

[](#solidframe-modular)

Modular monolith building blocks: module contracts, integration events, Anti-Corruption Layer, and module registry.

Build isolated modules that communicate through contracts, not concrete dependencies.

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

[](#installation)

```
composer require solidframe/modular
```

Quick Start
-----------

[](#quick-start)

### Define a Module

[](#define-a-module)

```
use SolidFrame\Modular\Module\AbstractModule;

final class OrderModule extends AbstractModule
{
    public function __construct()
    {
        parent::__construct(
            name: 'order',
            dependsOn: ['inventory', 'payment'],
        );
    }
}
```

### Register Modules

[](#register-modules)

```
use SolidFrame\Modular\Registry\InMemoryModuleRegistry;

$registry = new InMemoryModuleRegistry();
$registry->register(new OrderModule());
$registry->register(new InventoryModule());
$registry->register(new PaymentModule());

// List all modules
$modules = $registry->all();

// Get by name
$order = $registry->get('order');
$order->dependsOn(); // ['inventory', 'payment']

// Topological sort — respects dependency order
$sorted = $registry->dependencyOrder();
// [InventoryModule, PaymentModule, OrderModule]
```

Circular dependencies are detected automatically:

```
use SolidFrame\Modular\Exception\CircularDependencyException;

// A depends on B, B depends on A → throws CircularDependencyException
```

Module Contracts
----------------

[](#module-contracts)

Define what a module exposes to others via `ModuleContractInterface`:

```
use SolidFrame\Modular\Contract\ModuleContractInterface;

interface InventoryContractInterface extends ModuleContractInterface
{
    public function reserve(string $productId, int $quantity): void;
    public function checkAvailability(string $productId): int;
}
```

Other modules depend on the contract, never on the implementation:

```
final readonly class PlaceOrderHandler implements CommandHandler
{
    public function __construct(
        private InventoryContractInterface $inventory,
    ) {}

    public function __invoke(PlaceOrder $command): void
    {
        $this->inventory->reserve($command->productId, $command->quantity);
        // ...
    }
}
```

Integration Events
------------------

[](#integration-events)

Modules communicate asynchronously via integration events:

```
use SolidFrame\Modular\Event\AbstractIntegrationEvent;

final readonly class OrderPlacedIntegration extends AbstractIntegrationEvent
{
    public function __construct(
        public string $orderId,
        public string $productId,
        public int $quantity,
    ) {
        parent::__construct(sourceModule: 'order');
    }

    public function eventName(): string
    {
        return 'order.placed';
    }
}

// In another module's listener:
final readonly class ReserveInventoryOnOrderPlaced implements EventListener
{
    public function __invoke(OrderPlacedIntegration $event): void
    {
        $event->sourceModule(); // 'order'
        $event->occurredAt();   // DateTimeImmutable
        // reserve inventory...
    }
}
```

Anti-Corruption Layer
---------------------

[](#anti-corruption-layer)

Translate between module boundaries with `TranslatorInterface`:

```
use SolidFrame\Modular\AntiCorruption\TranslatorInterface;

/** @implements TranslatorInterface */
final readonly class OrderTranslator implements TranslatorInterface
{
    public function translate(object $source): object
    {
        return new DomainOrder(
            id: new OrderId($source->getId()),
            total: Money::from($source->getTotal(), $source->getCurrency()),
        );
    }
}
```

API Reference
-------------

[](#api-reference)

Class / InterfacePurpose`ModuleInterface`Contract for module definition`AbstractModule`Base module with name and dependencies`ModuleRegistryInterface`Module registration and lookup`InMemoryModuleRegistry`In-memory registry with topological sort`ModuleContractInterface`Marker for module public APIs`IntegrationEventInterface`Cross-module event contract`AbstractIntegrationEvent`Base integration event`TranslatorInterface`Anti-Corruption Layer translator`ModuleNotFoundException`Module not found in registry`CircularDependencyException`Circular module dependency detectedRelated Packages
----------------

[](#related-packages)

- [solidframe/core](../core) — DomainEventInterface, Bus interfaces
- [solidframe/event-driven](../event-driven) — EventBus for integration events
- [solidframe/cqrs](../cqrs) — Command/Query handling within modules
- [solidframe/archtest](../archtest) — Enforce module isolation rules
- [solidframe/laravel](../laravel) — ModuleServiceProvider, auto-discovery, `make:module`, `solidframe:module:list`
- [solidframe/symfony](../symfony) — Module discovery, `make:module`, `solidframe:module:list`

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

[](#contributing)

This repository is a read-only split of the [solidframe/solidframe](https://github.com/solidframe/solidframe) monorepo, auto-synced on every push to `main`. Issues, pull requests, and discussions belong in the monorepo.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance81

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity36

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

101d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97de2a466719393a21a8ce5caef247a1afb8aec5a8974248da0583f4197765b2?d=identicon)[abdulkadir-posul](/maintainers/abdulkadir-posul)

### Embed Badge

![Health badge](/badges/solidframe-modular/health.svg)

```
[![Health](https://phpackages.com/badges/solidframe-modular/health.svg)](https://phpackages.com/packages/solidframe-modular)
```

###  Alternatives

[thedmsgroup/mautic-contact-client-bundle

Create custom integrations without writing code.

994.0k](/packages/thedmsgroup-mautic-contact-client-bundle)

PHPackages © 2026

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