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

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mintyphp/session-handlers
=========================

Better session handlers

v1.0.4(1y ago)32.4k↑66.7%1MITPHP

Since Dec 9Pushed 1y agoCompare

[ Source](https://github.com/mintyphp/session-handlers)[ Packagist](https://packagist.org/packages/mintyphp/session-handlers)[ RSS](/packages/mintyphp-session-handlers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

MintyPHP session save handlers
==============================

[](#mintyphp-session-save-handlers)

This repository contains a set of PHP session save handlers that support locking. I also contains a test suite to prove that they do. Current handlers that can be tested (and their corresponding test mode) are:

- **standard**
    - **default** ([SessionHandler](https://www.php.net/manual/en/class.sessionhandler.php))
        Uses the "files" session module (PHP built-in).
    - **memcachedn** ([NativeMemcachedSessionHandler](src/NativeMemcachedSessionHandler.php))
        Uses the "memcached" session module (ext-memcached).
    - **redisn** ([NativeRedisSessionHandler](src/NativeRedisSessionHandler.php))
        Uses the "redis" session module (ext-redis).
- **strict** ([docs](https://www.php.net/manual/en/session.configuration.php#ini.session.use-strict-mode) / [rfc](https://wiki.php.net/rfc/strict_sessions))
    - **files** ([FilesSessionHandler](src/FilesSessionHandler.php))
        Locks using ".lock" files instead of "flock" calls.
    - **memcached** ([MemcachedSessionHandler](src/MemcachedSessionHandler.php))
        Locks using Memcache's atomic "add" operation.
    - **redis** ([RedisSessionHandler](src/RedisSessionHandler.php))
        Locks using Redis' atomic "setNx" operation.

Note that the standard mode testable handlers implement strict mode as well, but can't be tested as strict handlers.

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

[](#requirements)

You can install the dependencies of this script using:

```
sudo apt install php-cli php-curl

```

Optional dependencies can be installed using:

```
sudo apt install memcached php-memcached redis php-redis

```

You need PHP 7.4 or higher to run the code.

Using the handlers
------------------

[](#using-the-handlers)

This package is on [Packagist](https://packagist.org/packages/mintyphp/session-handlers) and can be installed using [Composer](https://getcomposer.org/download/), using:

```
composer require mintyphp/session-handlers

```

You can use the Redis handler by adding these two lines to your PHP code:

```
ini_set('session.save_path', 'tcp://localhost:6379');
ini_set('session.use_strict_mode', true);
session_set_save_handler(new RedisSessionHandler(), true);

```

Note that these lines must be executed before the "session\_start()" call.

Running the tests
-----------------

[](#running-the-tests)

You can run the tests from the command line using:

```
php run-tests.php

```

The code will execute in about 1 second per handler and test 104 HTTP calls for each handler. The following output means that the tests succeeded:

```
standard - default    : OK
standard - memcachedn : OK
standard - redisn     : OK
strict   - files      : OK
strict   - memcached  : OK
strict   - redis      : OK

```

The word "FAILED" appears on a failed test and "SKIPPED" is shown when the PHP module is not loaded for either Redis or Memcache.

Stress testing
--------------

[](#stress-testing)

Use this for 100 runs:

```
for i in `seq 1 100`; do php run-tests.php silent; done

```

As shown, you may use the argument "silent" to suppress output on successful or skipped tests.

Links to other locking handlers
-------------------------------

[](#links-to-other-locking-handlers)

Below you find a few other implementations of locking Session handlers:

-  (Symfony "files")
-  (Laravel "files")
-  (Redis)
-  (Redis)
-  (Redis)

Enjoy!

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance41

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.1% 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 ~253 days

Total

4

Last Release

498d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb92d699fb8e724c9a9091ee7182737ffdb5e392a8e137391d102aa8fda8de7b?d=identicon)[mevdschee](/maintainers/mevdschee)

---

Top Contributors

[![mevdschee](https://avatars.githubusercontent.com/u/1288217?v=4)](https://github.com/mevdschee "mevdschee (104 commits)")[![andersonamuller](https://avatars.githubusercontent.com/u/1681800?v=4)](https://github.com/andersonamuller "andersonamuller (2 commits)")

### Embed Badge

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

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

###  Alternatives

[ezsystems/ezpublish-legacy-installer

Installer for eZ Publish legacy extensions and legacy kernel itself.

10466.7k200](/packages/ezsystems-ezpublish-legacy-installer)

PHPackages © 2026

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