PHPackages                             monolyth/cesession - 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. monolyth/cesession

ActiveLibrary

monolyth/cesession
==================

Alternative PHP session handler for Monolyth unframework

1.1.11(1y ago)03701MITPHPPHP &gt;=7.3

Since Aug 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/monolyth-php/cesession)[ Packagist](https://packagist.org/packages/monolyth/cesession)[ RSS](/packages/monolyth-cesession/feed)WikiDiscussions master Synced today

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

CeSession
=========

[](#cesession)

Alternative PHP session handler for Monolyth unframework

Who is this for?
----------------

[](#who-is-this-for)

While PHP supports session handling, the implementation is less than stellar. Cesession provides an alternative with built-in helpers to use either an SQL database, memcached or a NoSQL database.

Cesession offers a seamless interface with the well-known `$_SESSION`superglobal, so any existing code should Just Work(tm).

An added advantage of using SQL based databases is that you can set up a foreign key constraint between the current user and the current session, so people get automatically logged out.

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

[](#installation)

### Composer (recommended)

[](#composer-recommended)

`$ composer require monolyth/cesession`

### Manual

[](#manual)

1. Clone or download the repository;
2. Add the `Monolyth\Cesession` namespace to your autoloader for `/path/to/cesession/src`.
3. Create the relevant table (see scripts in `./info/sql`)

That's it!

Setting up
----------

[](#setting-up)

To begin, *before* any call to `session_start` create the `Monolyth\Cesession\Session` object and register a *handler*. Currently Cesession ships with a `Pdo` handler that does exactly what its name implies (store the session data in a PDO-compatible database, e.g. PostgreSQL or MySQL):

```
