detain/session-samurai

🥷 Universal high-speed asynchronous (non-blocking) SessionHandlerInterface implementation for PHP supporting Semaphores, Mysqli, Redis, SQLite3, Symfony/Cache, WinCache, PhpFastCache, PHP-Cache, PDO, Memcached, FlySystem Filesystem, Illuminate, APCu, APC, OpCache, InfluxDB, WinCache, MongoDb and loc

v2.0.0 2025-05-12 13:02 UTC

This package is auto-updated.

Last update: 2025-05-12 13:03:02 UTC


README

check

Universal high-speed asynchronous (non-blocking) SessionHandlerInterface implementation for PHP supporting Semaphores, Mysqli, Redis, SQLite3, Symfony/Cache, WinCache, PhpFastCache, PHP-Cache, PDO, Memcached, FlySystem Filesystem, Illuminate, APCu, APC, OpCache, InfluxDB, WinCache, MongoDb and local file storage.

"Session handling is like a sword fight
You must think first before you move
When it's properly used it's almost invincible"

Project Status

Session Samurai 🥷 is fresh off the block and is still figuring out what it wants to do with its life. Soon it will grow into a mega-hotie that does the same stuff others do, only he makes it look good.

Installation

Use composer to include the save handler in your application.

composer requre detain/session-samurai

Usage

Using Memcached

require 'vendor/autoload.php';  // set up autoloading using composer

$memcached = new \Memcached();  // create connection to memcached
$memcached->addServer('localhost', 11211);
$handler = new \Detain\SessionSamurai\MemcachedSessionHandler($memcached);
session_set_save_handler($handler, true);

Using Redis

$redis = new \Redis();
$redis->connect('127.0.0.1', 6379);
$handler = new \Detain\SessionSamurai\RedisSessionHandler($redis);
session_set_save_handler($handler, true);

Development notes

Related sites with possibly good reference material