PHPackages                             xorock/expressive-zend-session - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. xorock/expressive-zend-session

ActiveLibrary[HTTP &amp; Networking](/categories/http)

xorock/expressive-zend-session
==============================

Zend Session middleware for Zend Expressive

0.1.1(9y ago)44.9k2BSD-3-ClausePHPPHP ^5.5 || ^7.0

Since Jul 28Pushed 9y ago2 watchersCompare

[ Source](https://github.com/xorock/expressive-zend-session)[ Packagist](https://packagist.org/packages/xorock/expressive-zend-session)[ RSS](/packages/xorock-expressive-zend-session/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

Zend Session middleware for Zend Expressive
===========================================

[](#zend-session-middleware-for-zend-expressive)

Provides [Zend Session](https://github.com/zendframework/zend-session) integration for [Expressive](https://github.com/zendframework/zend-expressive).

Install this library using composer:

```
$ composer require xorock/expressive-zend-session
```

Usage
-----

[](#usage)

I suggest installing [Expressive Configuration Manager](https://github.com/mtymek/expressive-config-manager)

Zend Session has built-in `ConfigProvider` class, responsible for automatic registration of the components. With Expressive Configuration Manager You can register all factories with just single line:

```
$configManager = new ConfigManager([
    \Zend\Session\ConfigProvider::class,
    new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
], 'data/config-cache.php');
```

Now, Zend Session will search Your merged config file for predefined keys. Please refer to Zend Session documentation.

As an example, We can create following file:

**session.global.php**

```
use Zend\Session\Storage\SessionArrayStorage;

return [
    'session_config' => [
        'name' => 'SID',
        'cookie_httponly' => true,
        'cookie_path' => '/',
        'cookie_secure' => false,
        'use_cookies' => true,
        'cookie_lifetime' => 3600,
        'save_path' => '/temp/data/session',
    ],
    'session_storage' => [
        'type' => SessionArrayStorage::class
    ],
];
```

**Note:** There is a [bug](https://github.com/zendframework/zend-session/issues/10) in SessionManager which can lead to fatal error when using SessionStorage class.

Now You can register middleware:

**middleware-pipeline.global.php**

```
use Mylab\Session\ZendSessionMiddleware;
use Mylab\Session\ZendSessionMiddlewareFactory;

// ...
'dependencies' => [
    'factories' => [
        Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
        Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,
        ZendSessionMiddleware::class => ZendSessionMiddlewareFactory::class,
    ],
],
'middleware_pipeline' => [
    'always' => [
        'middleware' => [
            Helper\ServerUrlMiddleware::class,
            ZendSessionMiddleware::class,
        ],
        'priority' => 10000,
    ]
]
```

Middleware injects `SessionManager` to `Container` so You can get it with:

```
use Zend\Session\Container;

Container::getDefaultManager();
```

**How can I use Session Save Handler?**

When created, `SessionManagerFactory` searches `Container` for addition keys. One of them is

```
$saveHandler = $container->get(SaveHandlerInterface::class);

```

Simply, if you wish to attach a save handler to the manager, you will need to write Your own factory, and assign it to the service name "Zend\\Session\\SaveHandler\\SaveHandlerInterface", (or alias that name to your own service).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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 ~0 days

Total

2

Last Release

3623d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/111481?v=4)[xorock](/maintainers/xorock)[@xorock](https://github.com/xorock)

---

Top Contributors

[![xorock](https://avatars.githubusercontent.com/u/111481?v=4)](https://github.com/xorock "xorock (3 commits)")

---

Tags

httppsrpsr-7middlewarezendsessionexpressive

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/xorock-expressive-zend-session/health.svg)

```
[![Health](https://phpackages.com/badges/xorock-expressive-zend-session/health.svg)](https://phpackages.com/packages/xorock-expressive-zend-session)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B3.8k](/packages/guzzlehttp-psr7)[mezzio/mezzio

PSR-15 Middleware Microframework

3913.8M120](/packages/mezzio-mezzio)[psr/http-server-middleware

Common interface for HTTP server-side middleware

18499.3M1.8k](/packages/psr-http-server-middleware)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[mezzio/mezzio-helpers

Helper/Utility classes for Mezzio

134.5M82](/packages/mezzio-mezzio-helpers)[mezzio/mezzio-fastroute

FastRoute integration for Mezzio

162.8M63](/packages/mezzio-mezzio-fastroute)

PHPackages © 2026

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