PHPackages                             brace/mod-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. [Framework](/categories/framework)
4. /
5. brace/mod-session

ActiveLibrary[Framework](/categories/framework)

brace/mod-session
=================

Session Component for Brace App Framework

v1.0.0-beta(5y ago)01.1kMITPHP

Since Mar 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/brace-project/brace-mod-session)[ Packagist](https://packagist.org/packages/brace/mod-session)[ Docs](https://infracamp.org)[ RSS](/packages/brace-mod-session/feed)WikiDiscussions main Synced 1mo ago

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

[![Action Status](https://github.com/brace-project/brace-mod-session/workflows/test/badge.svg)](https://github.com/brace-project/brace-mod-session/actions)[![Latest Stable Version](https://camo.githubusercontent.com/d2630721a93cf1fea5f2f74042936dce52c4603fe8665e08510e41db7cc535b5/68747470733a2f2f706f7365722e707567782e6f72672f62726163652f6d6f642d73657373696f6e2f76)](//packagist.org/packages/brace/mod-session)[![Total Downloads](https://camo.githubusercontent.com/5f9e235f0aeb036a37ea45916238fed4a1a1a76af56cc9c2ba11b9720fafe54d/68747470733a2f2f706f7365722e707567782e6f72672f62726163652f6d6f642d73657373696f6e2f646f776e6c6f616473)](//packagist.org/packages/brace/mod-session)[![License](https://camo.githubusercontent.com/4b106f67896a9b62e6a73cdb5d897072ea54b7cd3799037358c47bb18584ad38/68747470733a2f2f706f7365722e707567782e6f72672f62726163652f6d6f642d73657373696f6e2f6c6963656e7365)](//packagist.org/packages/brace/mod-session)

brace-mod-session
=================

[](#brace-mod-session)

Session middleware for Brace Core Applications

### Installation

[](#installation)

```
composer require brace/mod-session
```

### Usage

[](#usage)

You can use the `Brace\Session\SessionMiddleware` in any [Brace Core Application](https://github.com/brace-project/brace-core).

this would look like following:

```
\Brace\Core\AppLoader::extend(function (\Brace\Core\BraceApp $app) {
    (/*.....*/)
    $app->setPipe([
        new \Brace\Session\SessionMiddleware(
            new \Brace\Session\Storages\FileSessionStorage("/tmp"), // replace this with your chosen storage type and connection string
            3600, // 1 hour ttl
            86400 // 1 day expiration time
        ),
        (/*.....*/)
    ]);
});
```

After this, you can access the session data inside any route/middleware that has access to the `\Brace\Core\BraceApp` :

```
AppLoader::extend(function (BraceApp $app) {
    $app->router->on("GET@/", function() use ($app) {
        $session = $app->get(SessionMiddleware::SESSION_ATTRIBUTE);
        $session->set('foo', 'bar');
        (/*....*/)
        return $response;
    });
});
```

### Examples

[](#examples)

### Contributing

[](#contributing)

Please refer to the [contributing notes](CONTRIBUTING.md).

### License

[](#license)

This project is made public under the [MIT LICENSE](LICENSE)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 62.3% 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

1904d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/878a384d056698a2400e4b7c8858db05a6caebb2c560e67151be36d46d58def0?d=identicon)[dermatthes](/maintainers/dermatthes)

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

---

Top Contributors

[![Zulaas](https://avatars.githubusercontent.com/u/43743605?v=4)](https://github.com/Zulaas "Zulaas (33 commits)")[![dermatthes](https://avatars.githubusercontent.com/u/13380559?v=4)](https://github.com/dermatthes "dermatthes (20 commits)")

---

Tags

middleware-modulphp-sessionsession

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/brace-mod-session/health.svg)

```
[![Health](https://phpackages.com/badges/brace-mod-session/health.svg)](https://phpackages.com/packages/brace-mod-session)
```

###  Alternatives

[yiisoft/yii2-redis

Redis Cache, Session and ActiveRecord for the Yii framework

48011.7M245](/packages/yiisoft-yii2-redis)[yiisoft/session

A session service, PSR-15 session middleware, and a flash message service which helps use one-time messages.

20311.6k13](/packages/yiisoft-session)[adbario/slim-secure-session-middleware

Secure session middleware for Slim 3 framework

2932.3k2](/packages/adbario-slim-secure-session-middleware)[cse/helpers-session

The helpers allows you to easily manage session data. START, SET, GET DELETE, HAS method session - all this is available in this library.

102.6k3](/packages/cse-helpers-session)

PHPackages © 2026

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