PHPackages                             xp-forge/sessions - 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. xp-forge/sessions

ActiveLibrary

xp-forge/sessions
=================

Sessions

v4.0.0(4mo ago)175.7k—7.1%15BSD-3-ClausePHPPHP &gt;=7.4.0CI passing

Since May 10Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/xp-forge/sessions)[ Packagist](https://packagist.org/packages/xp-forge/sessions)[ Docs](http://xp-framework.net/)[ RSS](/packages/xp-forge-sessions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (20)Used By (5)

Sessions for the XP Framework
=============================

[](#sessions-for-the-xp-framework)

[![Build status on GitHub](https://github.com/xp-forge/sessions/workflows/Tests/badge.svg)](https://github.com/xp-forge/sessions/actions)[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/eb6b917c4403926c3d0d1f045465030e572d388b991b6b9fa37caaa21792ad2d/68747470733a2f2f706f7365722e707567782e6f72672f78702d666f7267652f73657373696f6e732f76657273696f6e2e737667)](https://packagist.org/packages/xp-forge/sessions)

Example
-------

[](#example)

```
use web\session\{InFileSystem, ForTesting};

// Instantiate session factory
$sessions= new InFileSystem('/tmp');
$sessions= (new ForTesting())->lasting(3600)->named('psessionid');

// Create a new session
$session= $sessions->create();

// Open an existing session...
if ($session= $sessions->open($sessionId)) { … }

// ...or locate session attached to a request
if ($session= $sessions->locate($request)) { … }

// Basic I/O operations
$session->register('key', 'value');
$value= $session->value('key');
$keys= $session->keys();
$session->remove('key');

// Destroy
$session->destroy();

// Close session...
$session->close();

// ...or close and then transmit session to response.
$session->transmit($response);
```

Ensure you always either call `close()` or `transmit()` to have the session data synchronized.

Implementations
---------------

[](#implementations)

This library includes the following implementations:

- `web.session.InFileSystem` - using the local filesystem with serialized data
- `web.session.ForTesting` - in-memory sessions, for testing purposes

Other implementations provide solutions for clustering:

-
-
-

Secure
------

[](#secure)

The [Secure flag](https://www.owasp.org/index.php/SecureFlag) is set for all session cookies. If you develop on localhost using *http* only, you will need to tell the sessions instance as follows:

```
// This will omit the "Secure" flag from session cookies in dev environment
$sessions= new InFileSystem('/tmp');
if ('dev' === $this->environment->profile()) {
  $sessions->cookies()->insecure(true);
}
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance75

Regular maintenance activity

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity72

Established project with proven stability

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

Recently: every ~326 days

Total

18

Last Release

134d ago

Major Versions

v0.6.0 → v1.0.02019-08-22

v1.0.2 → v2.0.02020-04-10

v2.1.2 → v3.0.02022-06-11

v3.2.1 → v4.0.02026-01-04

PHP version history (3 changes)v0.1.0PHP &gt;=5.6.0

v2.0.0PHP &gt;=7.0.0

v4.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07d18d882c8b4aaf3466432f64018214f2771eda333202175431ee7233795376?d=identicon)[thekid](/maintainers/thekid)

---

Top Contributors

[![thekid](https://avatars.githubusercontent.com/u/696742?v=4)](https://github.com/thekid "thekid (119 commits)")

---

Tags

php7php8session-cookiesessionswebxp-frameworkmodulexp

### Embed Badge

![Health badge](/badges/xp-forge-sessions/health.svg)

```
[![Health](https://phpackages.com/badges/xp-forge-sessions/health.svg)](https://phpackages.com/packages/xp-forge-sessions)
```

PHPackages © 2026

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