PHPackages                             phpsoftbox/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. phpsoftbox/session

ActiveLibrary[Framework](/categories/framework)

phpsoftbox/session
==================

Session component for the PhpSoftBox framework

0139↓85.7%PHP

Since Jun 18Pushed 2w agoCompare

[ Source](https://github.com/phpsoftbox/session)[ Packagist](https://packagist.org/packages/phpsoftbox/session)[ RSS](/packages/phpsoftbox-session/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Session
=======

[](#session)

Компонент для работы с сессиями.

Пример
------

[](#пример)

```
use PhpSoftBox\Session\Session;
use PhpSoftBox\Session\NativeSessionStore;

$session = new Session(new NativeSessionStore());
$session->start();

$session->set('user_id', 1);
$session->flash('notice', 'Saved');

$session->save();
```

DatabaseSessionStore
--------------------

[](#databasesessionstore)

Если session нужно хранить в БД, используйте `DatabaseSessionStore`. Он читает session id из cookie, хранит payload в таблице `sessions` и обновляет cookie через общий `CookieQueue`.

```
use PhpSoftBox\Cookie\CookieQueue;
use PhpSoftBox\Session\DatabaseSessionStore;
use PhpSoftBox\Session\Session;
use PhpSoftBox\Session\SessionConfig;

$store = new DatabaseSessionStore(
    connections: $connections,
    cookies: new CookieQueue(),
    config: new SessionConfig(name: 'psb_session'),
);

$session = new Session($store);
```

Пример миграции лежит в `database/migrations`. В приложении её можно опубликовать через `db:migrate:publish --package=phpsoftbox/session`.

Middleware
----------

[](#middleware)

```
use PhpSoftBox\Session\CsrfMiddleware;
use PhpSoftBox\Session\SessionMiddleware;

$sessionMw = new SessionMiddleware($session);
$csrfMw = new CsrfMiddleware($session);
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance63

Regular maintenance activity

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0279d150240c97d210034878b0467462246dc14d29b5618157ff6a8be49a50e3?d=identicon)[inspector-who](/maintainers/inspector-who)

---

Top Contributors

[![inspector-who](https://avatars.githubusercontent.com/u/6973963?v=4)](https://github.com/inspector-who "inspector-who (1 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M298](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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