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. hub20xx/session

ActiveLibrary

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 2mo 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 32% 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

3783d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e426783ef26ab33d4bee9989fbad30ed749bea6bcdf8ef779f4ef7b894b31a4?d=identicon)[hub20xx](/maintainers/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

[aura/session

Provides session management functionality, including lazy session starting, session segments, next-request-only ("flash") values, and CSRF tools.

2041.2M69](/packages/aura-session)[plasticbrain/php-flash-messages

A modern take on PHP session-based flash messages

184229.6k8](/packages/plasticbrain-php-flash-messages)[stefangabos/zebra_session

A drop-in replacement for PHP's default session handler which stores session data in a MySQL database, providing better performance, better security and protection against session fixation and session hijacking

174112.1k2](/packages/stefangabos-zebra-session)[yiisoft/session

A session service, PSR-15 session middleware, and a flash message service which helps use one-time messages.

20311.6k13](/packages/yiisoft-session)[devmarketer/laraflash

A powerful and flexible flash notifications system. Improving over built-in Laravel Flash messaging functionality.

6310.3k1](/packages/devmarketer-laraflash)[voku/session2db

A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.

2919.9k](/packages/voku-session2db)

PHPackages © 2026

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