PHPackages                             silverstripe/hybridsessions - 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. silverstripe/hybridsessions

ActiveSilverstripe-vendormodule

silverstripe/hybridsessions
===========================

Cookie/DB session support for SilverStripe

4.0.1(5mo ago)17490.0k—2.9%22[3 issues](https://github.com/silverstripe/silverstripe-hybridsessions/issues)3BSD-3-ClausePHPPHP ^8.3CI passing

Since Aug 15Pushed 5mo ago9 watchersCompare

[ Source](https://github.com/silverstripe/silverstripe-hybridsessions)[ Packagist](https://packagist.org/packages/silverstripe/hybridsessions)[ RSS](/packages/silverstripe-hybridsessions/feed)WikiDiscussions 4 Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (69)Used By (3)Security (1)

Hybrid Sessions
===============

[](#hybrid-sessions)

[![CI](https://github.com/silverstripe/silverstripe-hybridsessions/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-hybridsessions/actions/workflows/ci.yml)[![Silverstripe supported module](https://camo.githubusercontent.com/9b7e93d393a01f6d3091fb30983b870aa863ef076858115faaa1c74b995854ec/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73696c7665727374726970652d737570706f727465642d3030373143342e737667)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)

Introduction
------------

[](#introduction)

Adds a session handler that tries storing the session in an encrypted cookie when possible, and if not ( because the session is too large, or headers have already been set) stores it in the database.

This allows using Silverstripe on multiple servers without sticky sessions (as long as you solve other multi-server issues like asset storage and databases).

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

[](#limitations)

- MySQL database is the only supported DB store.

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

[](#installation)

```
composer require silverstripe/hybridsessions
```

Setup
-----

[](#setup)

- `sake db:build --flush` to setup the necessary tables
- In order to initiate the session handler is is necessary to add a snippet of code to your `_config.php` file, along with a private key used to encrypt user cookies.

in `app/src/_config.php`:

```
// Ensure that you define a sufficiently indeterminable value for SS_SESSION_KEY in your `.env`
use SilverStripe\Core\Environment;
use SilverStripe\HybridSessions\HybridSession;
HybridSession::init(Environment::getEnv('SS_SESSION_KEY'));
```

Security
--------

[](#security)

As long as the key is unguessable and secret, generally this should be as secure as server-side-only cookies. The one exception is that cookie sessions are vulnerable to replay attacks. This is only a problem if you're storing stuff you shouldn't in the session anyway, but it's important you understand the issue. Ruby on rails has good documentation of the issue at

### Crypto handlers

[](#crypto-handlers)

This module ships with two default cryptographic handlers:

- `OpenSSLCrypto`: uses the OpenSSL library (default).

You can also implement your own cryptographic handler by creating a class that implements the `SilverStripe\HybridSessions\Crypto\CryptoHandler` interface.

To configure the active handler, add YAML configuration to your project:

```
---
Name: myappsessionstores
After: sessionstores
---
SilverStripe\HybridSessions\HybridSession:
  SilverStripe\HybridSessions\Crypto\CryptoHandler:
    class: MyCustomCryptoHandler
```

Caveats
-------

[](#caveats)

This module is not fully compatible with the [testsession](https://github.com/silverstripe-labs/silverstripe-testsession/) module, as the database store is not available prior to DB connectivity, which uses the session to dictate DB connections. Data smaller than 1000 bytes may still be stored via the cookie store, but larger data sets will be lost.

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance69

Regular maintenance activity

Popularity48

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~56 days

Total

67

Last Release

154d ago

Major Versions

2.7.1 → 3.0.12023-05-31

2.7.2 → 3.0.22023-08-21

2.x-dev → 3.0.32024-02-12

3.0.5 → 4.0.0-alpha12024-12-02

3.x-dev → 4.0.02025-05-07

PHP version history (4 changes)2.4.0PHP ^7.3 || ^8.0

2.5.0PHP ^7.4 || ^8.0

3.0.0-beta1PHP ^8.1

4.0.0-alpha1PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/654636?v=4)[Aaron Carlino](/maintainers/unclecheese)[@unclecheese](https://github.com/unclecheese)

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

![](https://avatars.githubusercontent.com/u/111025?v=4)[Ingo Schommer](/maintainers/chillu)[@chillu](https://github.com/chillu)

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

![](https://www.gravatar.com/avatar/afbb3dcc9ef29c1a6eedd6addcae5fce9ab1271915a85a4c349301b71237368d?d=identicon)[silverstripe-machine01](/maintainers/silverstripe-machine01)

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

![](https://avatars.githubusercontent.com/u/1168676?v=4)[Maxime Rainville](/maintainers/maxime-rainville)[@maxime-rainville](https://github.com/maxime-rainville)

---

Top Contributors

[![emteknetnz](https://avatars.githubusercontent.com/u/4809037?v=4)](https://github.com/emteknetnz "emteknetnz (61 commits)")[![GuySartorelli](https://avatars.githubusercontent.com/u/36352093?v=4)](https://github.com/GuySartorelli "GuySartorelli (44 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (41 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (24 commits)")[![ScopeyNZ](https://avatars.githubusercontent.com/u/3260989?v=4)](https://github.com/ScopeyNZ "ScopeyNZ (12 commits)")[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (11 commits)")[![andreasgerhards](https://avatars.githubusercontent.com/u/20120862?v=4)](https://github.com/andreasgerhards "andreasgerhards (10 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (7 commits)")[![dnsl48](https://avatars.githubusercontent.com/u/9313746?v=4)](https://github.com/dnsl48 "dnsl48 (6 commits)")[![sabina-talipova](https://avatars.githubusercontent.com/u/87288324?v=4)](https://github.com/sabina-talipova "sabina-talipova (4 commits)")[![806software](https://avatars.githubusercontent.com/u/5340182?v=4)](https://github.com/806software "806software (3 commits)")[![gelysis](https://avatars.githubusercontent.com/u/4240408?v=4)](https://github.com/gelysis "gelysis (2 commits)")[![ichaber](https://avatars.githubusercontent.com/u/929858?v=4)](https://github.com/ichaber "ichaber (2 commits)")[![NightJar](https://avatars.githubusercontent.com/u/778003?v=4)](https://github.com/NightJar "NightJar (2 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![michalkleiner](https://avatars.githubusercontent.com/u/233342?v=4)](https://github.com/michalkleiner "michalkleiner (1 commits)")[![gbotti](https://avatars.githubusercontent.com/u/8247212?v=4)](https://github.com/gbotti "gbotti (1 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (1 commits)")[![halkyon](https://avatars.githubusercontent.com/u/138450?v=4)](https://github.com/halkyon "halkyon (1 commits)")[![johannesx75](https://avatars.githubusercontent.com/u/3908339?v=4)](https://github.com/johannesx75 "johannesx75 (1 commits)")

---

Tags

hacktoberfestsilverstripesessioncwp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/silverstripe-hybridsessions/health.svg)

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

###  Alternatives

[silverstripe/cms

The SilverStripe Content Management System

5163.4M1.3k](/packages/silverstripe-cms)[silverstripe/admin

SilverStripe admin interface

262.6M325](/packages/silverstripe-admin)[silverstripe/mimevalidator

Checks uploaded file content roughly matches a known MIME type for the file extension.

102.0M9](/packages/silverstripe-mimevalidator)[silverstripe/html5

HTML5 support for SilverStripe

16232.6k4](/packages/silverstripe-html5)[silverstripe/selectupload

Enables files to be uploaded into a user-designated folder

2779.1k1](/packages/silverstripe-selectupload)[silverstripe/taxonomy

Provide extra taxonomy for cataloguing the data.

10481.5k19](/packages/silverstripe-taxonomy)

PHPackages © 2026

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