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

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

hub20xx/session
===============

A simple session class

0.2.0(10y ago)024MITPHP

Since Jan 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/hub20xx/session)[ Packagist](https://packagist.org/packages/hub20xx/session)[ RSS](/packages/hub20xx-session/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Session
=======

[](#session)

[![Build Status](https://camo.githubusercontent.com/81dbe4dc31a726735c3ae7819fb12812bc45ecd506203e8998aa61f84f37831b/68747470733a2f2f7472617669732d63692e6f72672f687562323078782f73657373696f6e2e737667)](https://travis-ci.org/hub20xx/session)

A simple session class.

Install
-------

[](#install)

Via Composer

```
$ composer require hub20xxx/session
```

Usage
-----

[](#usage)

You can use the class to store / retrieve anything that can be stored in a php session.

```
// Forget about session_start():
//   - current session left alone if present
//   - new session started if no session present
$session = new \hub20xxx\Session\Session;

// Checking the existence of a session variable
$session->exists('variable'); // returns a boolean

// Setting session variables
$session->set('myString', 'stringy string');
$session->set('myArray', ['key' => 'value', 'otherKey' => 'otherValue']);
$session->set('myClass', new StdClass);

// Getting values of session variables
$mySessionString = $session->get('myString');
$mySessionArray = $session->get('myArray');
$mySessionClass = $session->get('myClass');

// Deleting session variables
$session->delete('myString');
$session->delete('myArray');
$session->delete('myClass');

// Flashing session variables
// 1. Setting the session variable (you can use the set method as well)
$session->flash('myFlashString', 'stringy string');
$session->flash('myFlashArray', ['key' => 'value', 'otherKey' => 'otherValue']);
$session->flash('myFlashClass', new StdClass);

// 2. Getting values of session variables and deleting them
$myFlashString = $session->flash('myFlashString');
$myFlashArray = $session->flash('myFlashArray');
$myFlashClass = $session->flash('myFlashClass');
```

Testing
-------

[](#testing)

```
$ phpunit
```

License
-------

[](#license)

[MIT](LICENSE.md)

Credits / Thanks
----------------

[](#credits--thanks)

This package was inpired (among others) by:

- [the Codecourse's tutorial on creating an OOP Login/Register System](https://www.youtube.com/playlist?list=PLfdtiltiRHWF5Rhuk7k4UAU1_yLAZzhWc) and especially [this video](https://www.youtube.com/watch?v=3yrpRfdtYc4) and [this video](https://www.youtube.com/watch?v=T_abxlvA1VE)
- [the SlimFlash package](https://github.com/slimphp/Slim-Flash)

Many thanks to them :)

Contributing
------------

[](#contributing)

If you'd like to contribute, please use Github (issues, pull requests etc).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Total

2

Last Release

3830d ago

### Community

Maintainers

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

---

Top Contributors

[![hub20xx](https://avatars.githubusercontent.com/u/16416438?v=4)](https://github.com/hub20xx "hub20xx (8 commits)")

---

Tags

sessionflash

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[plasticbrain/php-flash-messages

A modern take on PHP session-based flash messages

184229.8k8](/packages/plasticbrain-php-flash-messages)[laminas/laminas-session

Object-oriented interface to PHP sessions and storage

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

Session middleware and helper for Slim framework 4.

2411.0M16](/packages/bryanjhv-slim-session)[odan/session

A Slim session handler

64222.9k23](/packages/odan-session)[ikkez/f3-flash

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

2026.9k5](/packages/ikkez-f3-flash)[duncan3dc/sessions

A non-blocking session manager

28248.2k8](/packages/duncan3dc-sessions)

PHPackages © 2026

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