PHPackages                             mouf/utils.session.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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mouf/utils.session.session-manager

ActiveMouf-library[Utility &amp; Helpers](/categories/utility)

mouf/utils.session.session-manager
==================================

This package is used to manage sessions. It provides a DefaultSessionManager class that you can use to configure your PHP sessions, and a SessionManagerInterface that you can implement if you want to provide your own session management.

v4.0.0(3y ago)1254.8k2[1 issues](https://github.com/thecodingmachine/utils.session.session-manager/issues)8MITPHPPHP ^8.0

Since Jun 19Pushed 3y ago6 watchersCompare

[ Source](https://github.com/thecodingmachine/utils.session.session-manager)[ Packagist](https://packagist.org/packages/mouf/utils.session.session-manager)[ Docs](https://github.com/thecodingmachine/utils.session.session-manager)[ RSS](/packages/mouf-utilssessionsession-manager/feed)WikiDiscussions 4.0 Synced yesterday

READMEChangelog (2)Dependencies (6)Versions (7)Used By (8)

The Session Manager
===================

[](#the-session-manager)

The SessionManager package is in charge of managing the session for you.

Why do we need a session manager?
---------------------------------

[](#why-do-we-need-a-session-manager)

PHP offers a simple way to start sessions: the [`session_start`](http://php.net/manual/function.session-start.php) function. So you would we ever need to use another session mechanism?

Well, sessions can be configured in a lot of different ways. You can use [`session_set_save_handler`](http://php.net/manual/function.session_set_save_handler.php) to change completely the way sessions work. For instance, if you use Drupal, the sessions are stored in database. You could also configure your application to use a special "session handler".

Some components may need to access the session the way you do. So we decided to provide a simple way to initialize sessions. As a bonus, the SessionManager offers a lot of settings for managing your session graphically if you are using the Mouf framework.

Using the session manager
-------------------------

[](#using-the-session-manager)

Just enable the package in your project. When the package is enabled, you have a *sessionManager* instance create.

To start a session, use:

```
$sessionManager->start();
```

To write and close a session, use:

```
$sessionManager->write_close();
```

To destroy a session, use:

```
$sessionManager->destroy();
```

To regenerate a session id, use:

```
$sessionManager->regenerateId();
```

The DefaultSessionManager class
-------------------------------

[](#the-defaultsessionmanager-class)

The DefaultSessionManager uses the standard PHP mechanism to track sessions. It offers a number of parameters to configure the lifetime of a session, the path where session files are stored...

[![DefaultSessionManager](https://camo.githubusercontent.com/ce6f10e2652bd7f7ead47163398e5f93d6a594d7e8a5f7bacbea5d959bb9da70/68747470733a2f2f7261772e6769746875622e636f6d2f746865636f64696e676d616368696e652f7574696c732e73657373696f6e2e73657373696f6e2d6d616e616765722f322e312f646f632f64656661756c7473657373696f6e6d616e616765722e706e67)](https://camo.githubusercontent.com/ce6f10e2652bd7f7ead47163398e5f93d6a594d7e8a5f7bacbea5d959bb9da70/68747470733a2f2f7261772e6769746875622e636f6d2f746865636f64696e676d616368696e652f7574696c732e73657373696f6e2e73657373696f6e2d6d616e616765722f322e312f646f632f64656661756c7473657373696f6e6d616e616765722e706e67)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 56% 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 ~575 days

Recently: every ~667 days

Total

7

Last Release

1310d ago

Major Versions

2.1.x-dev → 3.0.x-dev2017-10-11

3.0.x-dev → 4.0.x-dev2022-12-01

PHP version history (2 changes)2.0.x-devPHP &gt;=5.3.0

4.0.x-devPHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (14 commits)")[![nguyenk](https://avatars.githubusercontent.com/u/2227554?v=4)](https://github.com/nguyenk "nguyenk (6 commits)")[![npeguin](https://avatars.githubusercontent.com/u/2227721?v=4)](https://github.com/npeguin "npeguin (2 commits)")[![homersimpsons](https://avatars.githubusercontent.com/u/16977446?v=4)](https://github.com/homersimpsons "homersimpsons (1 commits)")[![kassner](https://avatars.githubusercontent.com/u/301255?v=4)](https://github.com/kassner "kassner (1 commits)")[![xhuberty](https://avatars.githubusercontent.com/u/8350192?v=4)](https://github.com/xhuberty "xhuberty (1 commits)")

---

Tags

sessionmouf

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mouf-utilssessionsession-manager/health.svg)

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

###  Alternatives

[laminas/laminas-session

Object-oriented interface to PHP sessions and storage

8524.2M132](/packages/laminas-laminas-session)[bryanjhv/slim-session

Session middleware and helper for Slim framework 4.

2411.0M16](/packages/bryanjhv-slim-session)[plasticbrain/php-flash-messages

A modern take on PHP session-based flash messages

184229.8k8](/packages/plasticbrain-php-flash-messages)[rairlie/laravel-locking-session

Provide session locking in Laravel

92486.9k1](/packages/rairlie-laravel-locking-session)[vcian/pulse-active-sessions

A Laravel Pulse card to show active user session.

11582.7k](/packages/vcian-pulse-active-sessions)[odan/session

A Slim session handler

64222.9k24](/packages/odan-session)

PHPackages © 2026

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