PHPackages                             mediawiki/php-session-serializer - 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. mediawiki/php-session-serializer

Abandoned → [wikimedia/php-session-serializer](/?search=wikimedia%2Fphp-session-serializer)Library

mediawiki/php-session-serializer
================================

Provides methods like PHP's session\_encode and session\_decode that don't mess with $\_SESSION

v3.0.2(8mo ago)20397GPL-2.0-or-laterPHPPHP &gt;=7.4.0

Since Oct 14Pushed 2mo ago13 watchersCompare

[ Source](https://github.com/wikimedia/php-session-serializer)[ Packagist](https://packagist.org/packages/mediawiki/php-session-serializer)[ Docs](https://www.mediawiki.org/wiki/Php-session-serializer)[ RSS](/packages/mediawiki-php-session-serializer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (14)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/d59b74032e62395a470e94d681ae18cc22b0e374d0fb9df12ffdf71aea5ea34b/68747470733a2f2f706f7365722e707567782e6f72672f77696b696d656469612f7068702d73657373696f6e2d73657269616c697a65722f762f737461626c652e737667)](https://packagist.org/packages/wikimedia/php-session-serializer) [![License](https://camo.githubusercontent.com/15acf684b8ab5ad52130126bebf812631fb940b1f794d4656eac497bab502e06/68747470733a2f2f706f7365722e707567782e6f72672f77696b696d656469612f7068702d73657373696f6e2d73657269616c697a65722f6c6963656e73652e737667)](https://packagist.org/packages/wikimedia/php-session-serializer)

php-session-serializer
======================

[](#php-session-serializer)

php-session-serializer is a PHP library that provides methods that work like PHP's [session\_encode](https://php.net/manual/en/function.session-encode.php) and [session\_decode](https://php.net/manual/en/function.session-decode.php)functions, but don't mess with the `$_SESSION` superglobal.

It supports the `php`, `php_binary`, and `php_serialize` serialize handlers. `wddx` is not supported, since it is inferior to `php` and `php_binary`.

Usage
-----

[](#usage)

```
use Wikimedia\PhpSessionSerializer;

// (optional) Send logs to a PSR-3 logger
PhpSessionSerializer::setLogger( $logger )

// (optional) Ensure that session.serialize_handler is set to a usable value
PhpSessionSerializer::setSerializeHandler();

// Encode session data
$string = PhpSessionSerializer::encode( $array );

// Decode session data
$array = PhpSessionSerializer::decode( $string );
```

Running tests
-------------

[](#running-tests)

```
composer install --prefer-dist
composer test

```

History
-------

[](#history)

This library was created to support custom session handler [read](https://php.net/manual/en/sessionhandlerinterface.read.php) and [write](https://php.net/manual/en/sessionhandlerinterface.write.php) methods that are more useful than blindly storing the serialized data that PHP gives to custom handlers.

---

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance75

Regular maintenance activity

Popularity18

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~407 days

Total

13

Last Release

253d ago

Major Versions

v1.0.7 → v2.0.02021-03-21

v2.0.1 → v3.0.02024-08-13

PHP version history (4 changes)v1.0.0PHP &gt;=5.3.3

v1.0.5PHP &gt;=5.5.9

v2.0.0PHP &gt;=7.2.9

v3.0.0PHP &gt;=7.4.0

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/716c86d71cbf921e7912a505f89d799de398fc0a3af0bd4c8862834b2d642bd7?d=identicon)[wikimedia](/maintainers/wikimedia)

---

Top Contributors

[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (12 commits)")[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (10 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (9 commits)")[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (7 commits)")[![anomiex](https://avatars.githubusercontent.com/u/1030580?v=4)](https://github.com/anomiex "anomiex (5 commits)")[![bd808](https://avatars.githubusercontent.com/u/6469?v=4)](https://github.com/bd808 "bd808 (2 commits)")[![ricordisamoa](https://avatars.githubusercontent.com/u/4588496?v=4)](https://github.com/ricordisamoa "ricordisamoa (2 commits)")[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (2 commits)")[![MaxSem](https://avatars.githubusercontent.com/u/1260606?v=4)](https://github.com/MaxSem "MaxSem (1 commits)")[![fmalexander](https://avatars.githubusercontent.com/u/54070149?v=4)](https://github.com/fmalexander "fmalexander (1 commits)")[![DannyS712](https://avatars.githubusercontent.com/u/46829944?v=4)](https://github.com/DannyS712 "DannyS712 (1 commits)")[![Daimona](https://avatars.githubusercontent.com/u/38216014?v=4)](https://github.com/Daimona "Daimona (1 commits)")[![dringsim](https://avatars.githubusercontent.com/u/57343841?v=4)](https://github.com/dringsim "dringsim (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mediawiki-php-session-serializer/health.svg)

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

###  Alternatives

[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[api-platform/metadata

API Resource-oriented metadata attributes and factories

243.5M96](/packages/api-platform-metadata)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[flowwow/cloudpayments-php-client

cloudpayments api client

2188.2k](/packages/flowwow-cloudpayments-php-client)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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