PHPackages                             slabphp/session-manager - 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. [Database &amp; ORM](/categories/database)
4. /
5. slabphp/session-manager

ActiveLibrary[Database &amp; ORM](/categories/database)

slabphp/session-manager
=======================

SlabPHP Session Manager Library

v0.1.11(8y ago)21351Apache-2.0PHPCI failing

Since Feb 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/SlabPHP/session-manager)[ Packagist](https://packagist.org/packages/slabphp/session-manager)[ Docs](https://www.salernolabs.com/slab)[ RSS](/packages/slabphp-session-manager/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (13)Used By (1)

SlabPHP Session Manager
=======================

[](#slabphp-session-manager)

This session management library was built because I liked the idea of "flash data", and I wanted a set of re-usable session handlers that I could alternatively use in the native session handling system. I wanted those handlers to be embedded in an encapsulated object that managed the lifecycle of the handler for me but also managed the concept of flash data transparently.

Please see the main SlabPHP documentation for more information on the SlabPHP project.

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

[](#installation)

Include this library in your project

```
composer require slabphp/session-manager

```

Usage
-----

[](#usage)

General steps are to create a handler, instantiate a driver, use the driver to handle your sessions. The handlers themselves can be instantiated and then activated with just using the -&gt;startNativeSession() method.

### File Handler Session

[](#file-handler-session)

The file handler will use the built-in session save directory if you are using native session handling otherwise you may want do something like the following:

```
$handler = new \Slab\Session\Handlers\File();

$handler->setSavePath(ini_get('session.save_path'));

$driver = new \Slab\Session\Driver();

$driver
    ->setHandler($handler)
    ->start();

```

### Database Handler Session

[](#database-handler-session)

Assuming you have a mysqli object already open and created, you can feed it's reference into a database handler.

```
$handler = new \Slab\Session\Handlers\Database\MySQL();

$handler->setDatabase($myMySQLiObject, 'databaseName', 'tableName', 'site.com');

$driver = new \Slab\Session\Driver();

$driver
    ->setHandler($handler)
    ->start();

```

### Reading and Writing Data

[](#reading-and-writing-data)

Assuming you stored the session driver somewhere and have a reference to it called $session in the current object context:

```
// Will return a value if set, or false empty or not is set
$variableValue = $this->session->get('variableName');

```

Will retrieve the stored value. Otherwise you can set it with:

```
$this->session->set('variableName', 'some value');

```

You can delete data the data with -&gt;delete().

#### Flash Data

[](#flash-data)

Flash data is data that is set in a session and then deleted after the following request. You mark a variable as flash data by giving it an @ symbol as the first character.

For example, if you are on a postback controller and you set a value with:

```
$this->session->set('@success', true);
$this->redirect('/thanks');

```

On the following page you could read this flash var but it won't persist for anything longer than that next request. So in your view controller you could do something like:

```
if ($this->session->get('@success')) $this->displaySuccessMessage();

```

Subsequent loads of that page will not have the @success var because it will be deleted.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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

Total

12

Last Release

3008d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/155974?v=4)[Eric Salerno](/maintainers/ericsalerno)[@ericsalerno](https://github.com/ericsalerno)

---

Top Contributors

[![ericsalerno](https://avatars.githubusercontent.com/u/155974?v=4)](https://github.com/ericsalerno "ericsalerno (14 commits)")

---

Tags

databasenativephpphp7sessionsession-managementtests

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[guikingone/scheduler-bundle

A Symfony bundle that allows to schedule and create repetitive tasks

114217.4k](/packages/guikingone-scheduler-bundle)[symfony/ai-store

Low-level abstraction for storing and retrieving documents in a vector store.

19292.4k53](/packages/symfony-ai-store)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[bartlett/php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions

1183.0k1](/packages/bartlett-php-compatinfo-db)

PHPackages © 2026

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