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. [Utility &amp; Helpers](/categories/utility)
4. /
5. silverstripe/hybridsessions

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

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

Cookie/DB session support for SilverStripe

4.0.1(6mo ago)17510.8k↓43.8%21[3 issues](https://github.com/silverstripe/silverstripe-hybridsessions/issues)4BSD-3-ClausePHPPHP ^8.3CI failing

Since Aug 15Pushed 6mo ago9 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (69)Used By (4)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

63

—

FairBetter than 99% of packages

Maintenance63

Regular maintenance activity

Popularity47

Moderate usage in the ecosystem

Community37

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

199d 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/userforms

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code

1371.1M85](/packages/silverstripe-userforms)[symbiote/silverstripe-gridfieldextensions

A collection of useful grid field components

951.9M271](/packages/symbiote-silverstripe-gridfieldextensions)[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46302.4k9](/packages/symbiote-silverstripe-advancedworkflow)[silverstripe/tagfield

Tag field for SilverStripe

561.3M50](/packages/silverstripe-tagfield)[jonom/silverstripe-betternavigator

Front-end utility menu for Silverstripe websites featuring administration and development tools

60435.1k13](/packages/jonom-silverstripe-betternavigator)[lekoala/silverstripe-cms-actions

Add actions to your models in SilverStripe

39344.8k31](/packages/lekoala-silverstripe-cms-actions)

PHPackages © 2026

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