PHPackages                             ericmann/wp-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. ericmann/wp-session-manager

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

ericmann/wp-session-manager
===========================

Prototype session management for WordPress.

4.2.0(7y ago)27123.6k45[4 issues](https://github.com/ericmann/wp-session-manager/issues)[2 PRs](https://github.com/ericmann/wp-session-manager/pulls)1GPL-2.0-or-laterPHPPHP &gt;=7.1

Since Sep 30Pushed 3y ago23 watchersCompare

[ Source](https://github.com/ericmann/wp-session-manager)[ Packagist](https://packagist.org/packages/ericmann/wp-session-manager)[ Docs](https://github.com/ericmann/wp-session-manager)[ RSS](/packages/ericmann-wp-session-manager/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (4)Versions (16)Used By (1)

WP Session Manager [![Build Status](https://camo.githubusercontent.com/de09432f63952da1cb8eed9bd04e1e8f3efd93e96f56ac4069292812234212c6/68747470733a2f2f7472617669732d63692e6f72672f657269636d616e6e2f77702d73657373696f6e2d6d616e616765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ericmann/wp-session-manager) [![Coverage Status](https://camo.githubusercontent.com/f0578fde5b8561412a42f78f6e9d04aa1f0134aabf0e5c0c9645155e7be30aaf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f657269636d616e6e2f77702d73657373696f6e2d6d616e616765722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/ericmann/wp-session-manager?branch=master)
===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#wp-session-manager--)

Session management for WordPress.

Description
-----------

[](#description)

Adds `$_SESSION` functionality to WordPress, leveraging the database where needed to power multi-server installations.

Every visitor, logged in or not, will be issued a session. Session data will be stored in the WordPress database by default to deal with load balancing issues if multiple application servers are being used. In addition, the session collection will also be stored *in memory* for rapid use within WordPress.

Session data stored in the database can be encrypted at rest for better security.

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

[](#installation)

**Manual Installation**

1. Upload the entire `/wp-session-manager` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Use `$_SESSION` in your code.

Frequently Asked Questions
--------------------------

[](#frequently-asked-questions)

**How do I add session variables?**

Merely use the superglobal `$_SESSION` array:

```
$_SESSION['user_name'] = 'User Name';                            // A string
$_SESSION['user_contact'] = array( 'email' => 'user@name.com' ); // An array
$_SESSION['user_obj'] = new WP_User( 1 );                        // An object

```

**How long do session variables live?**

This depends on your PHP installation's configuration. Please read the [PHP manual](http://php.net/manual/en/session.configuration.php)for more details on configuration.

**Can I use this plugin without creating new tables?**

Absolutely! As of version 2.0, this plugin will create a new table for WordPress to store session data. In general, this is more efficient long-term than using options for data storage. However, if your system does not allow creating a table, add the following to `wp-config.php` to use the options table instead:

```
define( 'WP_SESSION_USE_OPTIONS', true );

```

**I get an error saying my PHP version is out of date. Why?**

PHP 5.6 was designated end-of-life and stopped receiving security patches in December 2018. PHP 7.0 was *also* marked end-of-life in December 2018. The minimum version of PHP supported by WP Session Manager is now PHP 7.1.

If your server is running an older version of PHP, the session system *will not work!* To avoid triggering a PHP error, the plugin will instead output this notice to upgrade and disable itself silently. You won't see a PHP error, but you also won't get session support.

Reach out to your hosting provider or system administrator to upgrade your server.

**I get an error saying another plugin is setting up a session. What can I do?**

WP Session Manager overrides PHP's default session implementation with its own custom handler. Unfortunately, we can't swap in a new handler if a session is already active. This plugin hooks into the `plugins_loaded` hook to set things up as early as possible, but if you have code in *another* plugin (or your theme) that attempts to invoke `session_start()` before WP Session Manager loads, then the custom handler won't work at all.

Inspect your other plugins and try to find the one that's interfering. Then, reach out to the developer to explain the conflict and see if they have a fix.

Screenshots
-----------

[](#screenshots)

None

Changelog
---------

[](#changelog)

**4.2.0**

- Update: Change donate link to Patreon vs PayPal.
- Fix: Disable the initialization routine for cron runs.

**4.1.1**

- Fix: Defensively protect deprecated functions with `function_exists()` checks to avoid conflicts with other systems.
- Fix: Disable the initialization routine if sessions are disabled.

**4.1.0**

- Fix: Add some defense to ensure end users are running the correct version of PHP before loading the system.
- Fix: Eliminate a race condition where another plugin or the theme created the session first.
- Fix: Schedule a cron to auto-delete expired sessions.

**4.0.0**

- New: Add an object cache based handler to leverage Redis or Memcached if available for faster queries.
- New: Adopt the Contributor Covenant (v1.4) as the project's official code of conduct.
- Update: Bump minimum PHP requirements due to out-of-date version deprecations.
- Fix: Correct a race condition where a session was created before the database table existed.
- Fix: Correct a race condition where the `$wpdb` global is not yet set when a session is deleted from the database.
- Fix: Remove unnecessary integer session ID from the stored data table.

**3.0.4**

- Update: Add support for the `wp_install` hook to create custom table immediately.

**3.0.3**

- Fix: Repair code blocks in the readme
- Fix: Use a more defensive approach to starting sessions in the event another plugin has started one already

**3.0.2**

- Fix: Add back in proper array access support for the deprecated `WP_Session` object.

**3.0.1**

- Update: Pull a Sessionz fix

**3.0.0**

- Update: Refactor to use Sessionz
- Update: Add encryption at rest if `WP_SESSION_ENC_KEY` is set

**2.0.2**

- Fix: Wire the data storage migration to a session init hook to ensure it runs.
- Fix: Clean up sessions when all data is removed.

**2.0.1**

- Fix: Repair data storage that was not returning actual stored session data.

**2.0.0**

- Update: Use a table instead of options for storing session data.

**1.2.2**

- Update: Use regex pattern matching to ensure session IDs are identical going in/out of the DB to account for encoding differences

**1.2.1**

- Update: Additional filters for the `setcookie` parameters
- Update: Expose the Session ID publicly
- Fix: Better handling for malformed or broken session names

**1.2.0**

- Update: Enhanced plugin organization
- Update: Added WP\_CLI support for session management
- Update: Add Composer definitions
- Fix: Break up the deletion of old sessions so queries don't time out under load

**1.1.2**

- Fix a race condition where session expiration options could accidentally be set to autoload
- Make the garbage collection routine run hourly to alleviate long-running tasks on larger sites

**1.1.1**

- Fix a bug where session expiration was not properly set upon instantiation

**1.1**

- Implement Recursive\_ArrayAccess to provide multidimensional array support
- Better expiration for session data
- Implement garbage collection to keep the database clean

**1.0.2**

- Switch to object persistence rather than transients

**1.0.1**

- Changes implementation to avoid the use of a global variable (still registered for convenience)

**1.0**

- First version

Upgrade Notice
--------------

[](#upgrade-notice)

**4.0**This version requires PHP 7.1 or higher.

**3.0**This version requires PHP 5.6 or higher and uses Composer-powered autoloading to incorporate [Sessionz](https://github.com/ericmann/sessionz) for transparent session management.

**2.0**

This version will create a new database table for storing session data! If you do not want such a table, please set the `WP_SESSION_USE_OPTIONS` constant to `true` in `wp-config.php`! Upgrading will delete all existing sessions!

**1.0**

First version

Additional Information
----------------------

[](#additional-information)

**Contributors:** ericmann
**Donate link:**
**Tags:** session
**Requires at least:** 4.7
**Tested up to:** 5.1.1
**Requires PHP:** 7.1
**Stable tag:** 4.2.0
**License:** GPLv2 or later
**License URI:**

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~117 days

Recently: every ~105 days

Total

15

Last Release

2605d ago

Major Versions

1.2.2 → 2.0.02017-12-01

2.0.2 → 3.0.02018-01-16

3.0.4 → 4.0.02019-01-01

PHP version history (2 changes)3.0.0PHP &gt;=5.6

4.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/86bb3fa9fcfe57b8d313e527e9e02bde810951b25722b4717b0953a6c8db41b2?d=identicon)[ericmann](/maintainers/ericmann)

---

Top Contributors

[![ericmann](https://avatars.githubusercontent.com/u/605474?v=4)](https://github.com/ericmann "ericmann (72 commits)")[![chrisguitarguy](https://avatars.githubusercontent.com/u/1010392?v=4)](https://github.com/chrisguitarguy "chrisguitarguy (3 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (2 commits)")[![tollmanz](https://avatars.githubusercontent.com/u/921795?v=4)](https://github.com/tollmanz "tollmanz (2 commits)")[![nciske](https://avatars.githubusercontent.com/u/974354?v=4)](https://github.com/nciske "nciske (2 commits)")[![lynnbgriffith](https://avatars.githubusercontent.com/u/449804?v=4)](https://github.com/lynnbgriffith "lynnbgriffith (1 commits)")[![pderksen](https://avatars.githubusercontent.com/u/79667?v=4)](https://github.com/pderksen "pderksen (1 commits)")[![pjeby](https://avatars.githubusercontent.com/u/3527052?v=4)](https://github.com/pjeby "pjeby (1 commits)")[![anhskohbo](https://avatars.githubusercontent.com/u/1529454?v=4)](https://github.com/anhskohbo "anhskohbo (1 commits)")[![truongwp](https://avatars.githubusercontent.com/u/19748318?v=4)](https://github.com/truongwp "truongwp (1 commits)")[![crxgames](https://avatars.githubusercontent.com/u/1211476?v=4)](https://github.com/crxgames "crxgames (1 commits)")[![julien731](https://avatars.githubusercontent.com/u/1441024?v=4)](https://github.com/julien731 "julien731 (1 commits)")[![kai-jacobsen](https://avatars.githubusercontent.com/u/1179975?v=4)](https://github.com/kai-jacobsen "kai-jacobsen (1 commits)")[![lewayotte](https://avatars.githubusercontent.com/u/3740605?v=4)](https://github.com/lewayotte "lewayotte (1 commits)")

---

Tags

session

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[bryanjhv/slim-session

Session middleware and helper for Slim framework 4.

233961.5k16](/packages/bryanjhv-slim-session)[plasticbrain/php-flash-messages

A modern take on PHP session-based flash messages

184229.6k8](/packages/plasticbrain-php-flash-messages)[vcian/pulse-active-sessions

A Laravel Pulse card to show active user session.

11469.2k](/packages/vcian-pulse-active-sessions)[ikkez/f3-flash

Add simple Flash Messages and Flash Keys to PHP Fat-Free Framework

1926.0k5](/packages/ikkez-f3-flash)[kevinsimard/laravel-cookieless-session

Laravel middleware to start a cookieless session

1417.0k](/packages/kevinsimard-laravel-cookieless-session)[compwright/php-session

Standalone session implementation that does not rely on the PHP session module or the $\_SESSION global, ideal for ReactPHP applications

189.4k](/packages/compwright-php-session)

PHPackages © 2026

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