PHPackages                             delfimov/session - 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. delfimov/session

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

delfimov/session
================

Easy to use library for managing PHP built-in sessions

v1.0.2(8y ago)2141↓100%MITPHPPHP &gt;=7.1

Since Feb 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/delfimov/Session)[ Packagist](https://packagist.org/packages/delfimov/session)[ Docs](https://github.com/delfimov/Session/)[ RSS](/packages/delfimov-session/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (7)Versions (4)Used By (0)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/delfimov/GDImage/blob/master/LICENSE)

Session
=======

[](#session)

PSR-11 compatible easy to use library for managing PHP built-in sessions. PDO handler included.

Requirements
------------

[](#requirements)

- [PHP &gt;= 7.1](http://www.php.net/)

How to install
--------------

[](#how-to-install)

Add this line to your composer.json file:

```
"delfimov/session": "~1.0"
```

or

```
composer require delfimov/session
```

How to configure
----------------

[](#how-to-configure)

The session management system supports a number of configuration options which you can place in your php.ini file or redefine in your code.

The most important settings with recommended values:

```
session.name = PHPSESSID
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 2592000
; lifetime of sessions = 60*60*24*30 = 30 days
session.use_cookies = 1
session.use_only_cookies = 1
session.cookie_lifetime = 2592000
; same as session lifetime
```

I highly recommend to use https protocol and marks the cookie as accessible only through the HTTP protocol.

```
session.cookie_secure = 1
session.cookie_httponly = 1
```

See [PHP Sessions Runtime Configuration](https://secure.php.net/manual/en/session.configuration.php)for more details.

An example
----------

[](#an-example)

See [`example`](example) directory for sources.

```
require_once __DIR__ . '/../vendor/autoload.php';
$session = new DElfimov\Session\Session(
    new DElfimov\Session\Handlers\PDOHandler(
            new \PDO('mysql:dbname=testdb;host=127.0.0.1', 'dbuser', 'dbpass')
    )
);

$session->set('a', 'value a');

try {
    echo $session->get('a');
} catch (\Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}

if ($session->has('b')) {
    echo 'Wonder!';
}

$session->remove('a');
```

TODO
----

[](#todo)

- Better code coverage
- Handlers

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

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

Total

3

Last Release

3006d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/21d17db0fdf19ea4a056ff6e6ae8b414a7b7731320acfca24020aafe1167c892?d=identicon)[elfimov](/maintainers/elfimov)

---

Top Contributors

[![delfimov](https://avatars.githubusercontent.com/u/703273?v=4)](https://github.com/delfimov "delfimov (5 commits)")

---

Tags

handlerpdophppsr-11sessionsphpPSR-11mysqlpdosessions

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[eftec/pdoone

Minimaist procedural PDO wrapper library

1105.9k9](/packages/eftec-pdoone)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)[riverside/php-orm

PHP ORM micro-library and query builder

111.2k](/packages/riverside-php-orm)

PHPackages © 2026

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