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

Abandoned → [mtymek/expressive-config-manager](/?search=mtymek%2Fexpressive-config-manager)Library[Framework](/categories/framework)

mtymek/modular-expressive
=========================

Deprecated in favour of mtymek/expressive-config-manager. Provides integration between Zend Expressive and ZF2 modules

0.2.3(10y ago)66912-Clause BSDPHPPHP &gt;=5.5

Since Aug 22Pushed 10y ago3 watchersCompare

[ Source](https://github.com/mtymek/modular-expressive)[ Packagist](https://packagist.org/packages/mtymek/modular-expressive)[ RSS](/packages/mtymek-modular-expressive/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

Modular Expressive \[deprecated\]
=================================

[](#modular-expressive-deprecated)

> **Note:** this package is now deprecated. Please use [mtymek/expressive-config-manager](https://github.com/mtymek/expressive-config-manager) instead.

**Build `zend-expressive` application using Zend Framework-compatible modules.**

[![Build Status](https://camo.githubusercontent.com/ee264fbf46a7a07e1c1495e7da6ea43d815199bed897f73b78732975b7fe8712/68747470733a2f2f7472617669732d63692e6f72672f6d74796d656b2f6d6f64756c61722d657870726573736976652e737667)](https://travis-ci.org/mtymek/modular-expressive)[![Coverage Status](https://camo.githubusercontent.com/4bbd076796b7aebe6741a0a8dfc1a81e8f4c452f0eb6a59101bbd930f822301c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6d74796d656b2f6d6f64756c61722d657870726573736976652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/mtymek/modular-expressive?branch=master)

There are three main scenarios where Modular Expressive can be very helpful:

- you want to split your application logic into modules that share configuration and services, in a same way you would do in ZF2.
- you want to reuse some ZF2 modules (see "[Limitations](#limitations)" section below)
- you are migrating ZF2 application to Expressive

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

[](#installation)

Install this library using composer:

```
$ composer require mtymek/modular-expressive
```

Usage
-----

[](#usage)

`Modular Expressive`'s core is a factory that can load Zend Framework modules, build config for ServiceManager, and use it to create `Zend\Expressive\Application` object.

```
// index.php
use ModularExpressive\ModularApplicationFactory;

$appFactory = new ModularApplicationFactory();
$app = $appFactory->create(
     // system configuration, similar to ZF2
    [
        'modules' => [
            'Application',
            'AnotherModule'
        ],
        'module_listener_options' => [
            'config_glob_paths' => [
                'config/autoload/{{,*.}global,{,*.}local}.php',
            ],
        ]
    ]
);
$app->run();
```

Module class is simplified version of what is consumed by ZF2:

```
namespace Application;

class Module
{
    public function getConfig()
    {
        return include __DIR__ . '/../config/module.config.php';
    }
}
```

Module configuration can be merged to speed up application bootstrap - it is done exactly as in ZF app, using system configuration:

```
return [
    'module_listener_options' => [
        'config_glob_paths' => [
            __DIR__ . '/autoload/{,*.}{global,local}.php'
        ],

        'config_cache_enabled' => true,
        'config_cache_key' => 'config',
        'cache_dir' => 'data/cache',
    ],
];
```

Limitations
-----------

[](#limitations)

Obviously Expressive is different product than Zend Framework, so you cannot expect every module to work seamlessly under both environments. ZF architecture is event-driven, so a lot of 3rd party modules will attach listeners to different points of execution (routing, dispatching, rendering...). This won't work under Expressive without at least some wiring.

However, there are many useful modules that exist only to provide configuration and factories for `ServiceManager`, and they can be re-used with this library without any extra code.

Advanced usage
--------------

[](#advanced-usage)

### Custom ModuleManager

[](#custom-modulemanager)

Modular Expressive is designed to keep ModuleManager's overhead minimal, so by default only feature it supports is configuration merging. There is a way to enable other module functionalities by injecting custom ModuleManager into `ModularApplicationFactory`.

For example, here's how to allow modules to execute some initialization logic (using `init()` method):

```
use Zend\ModuleManager\Listener\ConfigListener;
use Zend\ModuleManager\Listener\InitTrigger;
use Zend\ModuleManager\Listener\ModuleResolverListener;
use Zend\ModuleManager\ModuleManager;

$moduleManager = new ModuleManager([]);
$moduleManager->getEventManager()->attach(
    ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener()
);
$this->moduleManager->getEventManager()->attach(
    ModuleEvent::EVENT_LOAD_MODULE, new InitTrigger()
);

// inject custom manager into application factory
$appFactory = new ModularApplicationFactory($moduleManager);
```

After this setup you can add `init()` method to your modules that will be executed on startup:

```
namespace Application;

class Module
{
    public function getConfig()
    {
        return include __DIR__ . '/../config/module.config.php';
    }

    public function init()
    {
        // initialization code!
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Every ~25 days

Total

5

Last Release

3820d ago

PHP version history (2 changes)0.1.0PHP ^5.5

0.2.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6c602b2763105f372ab3b806222f75b1872931a3451e8192c43d22287fde726?d=identicon)[mtymek](/maintainers/mtymek)

---

Top Contributors

[![mtymek](https://avatars.githubusercontent.com/u/777893?v=4)](https://github.com/mtymek "mtymek (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[ppi/framework

PPI Framework - The PHP Interoperability Framework!

1542.4k6](/packages/ppi-framework)

PHPackages © 2026

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