PHPackages                             cse/helpers-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. [Framework](/categories/framework)
4. /
5. cse/helpers-session

ActiveLibrary[Framework](/categories/framework)

cse/helpers-session
===================

The helpers allows you to easily manage session data. START, SET, GET DELETE, HAS method session - all this is available in this library.

1.1.3(7y ago)102.6k↓50%23MITPHPPHP &gt;=7.1

Since Feb 2Pushed 7y ago3 watchersCompare

[ Source](https://github.com/cs-eliseev/helpers-session)[ Packagist](https://packagist.org/packages/cse/helpers-session)[ Docs](https://github.com/cs-eliseev/helpers-session)[ RSS](/packages/cse-helpers-session/feed)WikiDiscussions master Synced 1mo ago

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

English | [Русский](https://github.com/cs-eliseev/helpers-session/blob/master/README.ru_RU.md)

SESSION CSE HELPERS
===================

[](#session-cse-helpers)

[![Travis (.org)](https://camo.githubusercontent.com/ab6769797cbb1f0305850cf440ff939923c2dbbfd6c497d9c8beee91f5e2ca59/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f63732d656c69736565762f68656c706572732d73657373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/cs-eliseev/helpers-session)[![Codecov](https://camo.githubusercontent.com/c65e053e4aff66d4d3380cb87b4608544e7e66116cbb03a819b81bcaa644964e/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f63732d656c69736565762f68656c706572732d73657373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/cs-eliseev/helpers-session)[![Scrutinizer code quality](https://camo.githubusercontent.com/e85bee581ef272ff0171cc239af99fdf9c35a9dd710738bc3ca3c58dd0948316/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f63732d656c69736565762f68656c706572732d73657373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cs-eliseev/helpers-session/?branch=master)

[![Packagist](https://camo.githubusercontent.com/71ac132ca991465ac4a34206cc7219d87bee611784bd43ddf8f9ba0bc7ad5573/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6373652f68656c706572732d73657373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cse/helpers-session)[![Minimum PHP Version](https://camo.githubusercontent.com/dcd4b4aec2c1709157fa6a2c050f709d75cde9552a79cfff0b70a97fad7281ae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cse/helpers-session)[![Packagist](https://camo.githubusercontent.com/9478e8496d50cc6da43c7856cd0ed9b68ef1b60c63749be132163d90e4654064/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6373652f68656c706572732d73657373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/cs-eliseev/helpers-session/blob/master/LICENSE.md)[![GitHub repo size](https://camo.githubusercontent.com/daf21c9ab5c7dfca2181fb48686556ab7b8adec36ac2ea25726a188ff253e739/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f63732d656c69736565762f68656c706572732d73657373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/cs-eliseev/helpers-session/archive/master.zip)

The helpers allows you to easily manage session data. START, SET, GET DELETE, HAS method session - all this is available in this library.

Project repository:

**DEMO**

```
Session::set(
    'example_key',
    Session::getNotEmpty('example_key', 'default_value')
);

if (is_int(Session::get('example_key'))) {
    Session::remove('example_key');
}

$is_not_int = Session::has('example_key');
```

---

Introduction
------------

[](#introduction)

[CSE HELPERS](https://github.com/cs-eliseev/helpers/blob/master/README.md) is a collection of several libraries with simple functions written in PHP for people.

Despite using PHP as the main programming language for the Internet, its functions are not enough. SESSION CSE HELPERS allows you to easy START, SET, GET DELETE session.

[CSE HELPERS](https://github.com/cs-eliseev/helpers/blob/master/README.md) was created for the rapid development of web applications.

**CSE Helpers project:**

- [Array CSE helpers](https://github.com/cs-eliseev/helpers-arrays)
- [Cookie CSE helpers](https://github.com/cs-eliseev/helpers-cookie)
- [Date CSE helpers](https://github.com/cs-eliseev/helpers-date)
- [Email CSE helpers](https://github.com/cs-eliseev/helpers-email)
- [IP CSE helpers](https://github.com/cs-eliseev/helpers-ip)
- [Json CSE helpers](https://github.com/cs-eliseev/helpers-json)
- [Math Converter CSE helpers](https://github.com/cs-eliseev/helpers-math-converter)
- [Phone CSE helpers](https://github.com/cs-eliseev/helpers-phone)
- [Request CSE helpers](https://github.com/cs-eliseev/helpers-request)
- [Session CSE helpers](https://github.com/cs-eliseev/helpers-session)
- [Word CSE helpers](https://github.com/cs-eliseev/helpers-word)

Below you will find some information on how to init library and perform common commands.

Install
-------

[](#install)

You can find the most recent version of this project [here](https://github.com/cs-eliseev/helpers-session).

### Composer

[](#composer)

Execute the following command to get the latest version of the package:

```
composer require cse/helpers-session
```

Or file composer.json should include the following contents:

```
{
    "require": {
        "cse/helpers-session": "*"
    }
}
```

### Git

[](#git)

Clone this repository locally:

```
git clone https://github.com/cs-eliseev/helpers-session.git
```

### Download

[](#download)

[Download the latest release here](https://github.com/cs-eliseev/helpers-session/archive/master.zip).

Usage
-----

[](#usage)

The class consists of static methods that are conveniently used in any project. See example [examples-session.php](https://github.com/cs-eliseev/helpers-session/blob/master/examples/examples-session.php).

**START session**

Example:

```
Session::start();
// true
```

**SET session**

Example:

```
Session::set('example_key', 'example_value');
// ['example_key' => 'example_value']
```

Use multi key:

```
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
// ['cse' => ['example_key_2' => 'example_value_2']]
```

**HAS session**

Example:

```
Session::set('example_key', 'example_value');
Session::has('example_key');
// true
```

Use multi key:

```
Session::setMultiKey('cse');
Session::has('example_key');
// false
```

**GET session**

Example:

```
Session::set('example_key', 'example_value');
Session::get('example_key');
// example_value
```

Use multi key:

```
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
Session::get('example_key_2');
// example_value_2
```

Set default value is not exist session:

```
Cookie::get('example_key_3', 'example_default_value_3');
// example_default_value_3
```

**GET NOT EMPTY session**

Example:

```
Session::set('example_key', 'example_value');
Session::getNotEmpty('example_key', 'example_default_value');
// example_value
```

Use multi key:

```
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
Session::getNotEmpty('example_key_2');
// example_value_2
```

Set default value is not exist session:

```
Cookie::getNotEmpty('example_key_3', 'example_default_value_3');
// example_default_value_3
```

Set default value empty session data:

```
Session::set('example_key_4', '');
Cookie::getNotEmpty('example_key_4', 'example_default_value_4');
// example_default_value_4
```

**REMOVE session**

Example:

```
Session::set('example_key', 'example_value');
Session::remove('example_key');
Session::has('example_key');
// false
```

Use multi key:

```
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
Session::remove('example_key_2');
Session::has('example_key_2');
// false
```

**SET MULTI KEY session**

Example:

```
Session::set('example_key', 'example_value');
// ['example_key' => 'example_value']
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
/**
* [
*     'example_key' => 'example_value',
*     'cse' => [
*         'example_key_2' => 'example_value_2'
*     ]
* ]
*/
Session::set('example_key_3', 'example_value_3');
/**
* [
*     'example_key' => 'example_value',
*     'cse' => [
*         'example_key_2' => 'example_value_2',
*         'example_key_3' => 'example_value_3'
*     ]
* ]
*/
Session::setMultiKey();
Session::set('example_key_4', 'example_value_4');
/**
* [
*     'example_key' => 'example_value',
*     'cse' => [
*         'example_key_2' => 'example_value_2',
*         'example_key_3' => 'example_value_3'
*     ],
*     'example_key_4' => 'example_value_4',
*     'example' => [
*         'example_key_5' => 'example_value_5'
*     ],
* ]
*/
Session::setMultiKey('example');
Session::set('example_key_5', 'example_value_5');
```

Global use:

```
class DefaultSessionData
{
    public function setSessionData(): void
    {
        Session::setMultiKey();
        Session::set('example_key_2', 'example_value_2');
    }
}

class CseSessionData
{
    public function setSessionData(): void
    {
        Session::setMultiKey('cse');
        Session::set('example_key_1', 'example_value_1');
    }
}

class ExtendSessionData
{
    public function setSessionData(string $key, string $value): void
    {
        Session::set($key, $value);
    }
}

$default = new DefaultSessionData();
$cse = new CseSessionData();
$extend = new ExtendSessionData();

$extend->setSessionData('example_key_0', 'example_value_0');
// ['example_key_0' => 'example_value_0']
$cse->setSessionData();
/**
* [
*     'example_key_0' => 'example_value_0',
*     'cse' => [
*         'example_key_1' => 'example_value_1'
*     ]
* ]
*/
$extend->setSessionData('example_key_1_1', 'example_value_1_1');
/**
* [
*     'example_key_0' => 'example_value_0',
*     'cse' => [
*         'example_key_1' => 'example_value_1',
*         'example_key_1_1' => 'example_value_1_1'
*     ]
* ]
*/
$default->setSessionData();
/**
* [
*     'example_key_0' => 'example_value_0',
*     'cse' => [
*         'example_key_1' => 'example_value_1',
*         'example_key_1_1' => 'example_value_1_1'
*     ],
*     'example_key_2' => 'example_value_2'
* ]
*/
$extend->setSessionData('example_key_2_1', 'example_value_2_1');
/**
* [
*     'example_key_0' => 'example_value_0',
*     'cse' => [
*         'example_key_1' => 'example_value_1',
*         'example_key_1_1' => 'example_value_1_1'
*     ],
*     'example_key_2' => 'example_value_2',
*     'example_key_2_1' => 'example_value_2_1'
* ]
*/
```

**Get ALL session data**

Example:

```
Session::set('example_key', 'example_value');
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
Session::setMultiKey();
Session::all();
/**
* [
*     'example_key' => 'example_key',
*     'cse' => [
*         'example_key_2' => 'example_value_2'
*     ]
* ]
*/
```

Use multi key:

```
Session::set('example_key', 'example_value');
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
Session::all();
// ['example_key_2' => 'example_value_2']
```

**CLEAR session data**

Example:

```
Session::set('example_key', 'example_value');
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
Session::setMultiKey();
Session::claer();
// []
```

Use multi key:

```
Session::set('example_key', 'example_value');
Session::setMultiKey('cse');
Session::set('example_key_2', 'example_value_2');
Session::claer();
// ['example_key' => 'example_value']
```

**DESTROY session**

Example:

```
Session::start();
// session_status() === PHP_SESSION_ACTIVE => true
Session::destroy();
// session_status() === PHP_SESSION_ACTIVE => false
```

**IS START session**

Example:

```
Session::start();
Session::isStart();
// true
Session::destroy();
Session::isStart();
// false
```

Testing &amp; Code Coverage
---------------------------

[](#testing--code-coverage)

PHPUnit is used for unit testing. Unit tests ensure that class and methods does exactly what it is meant to do.

General PHPUnit documentation can be found at .

To run the PHPUnit unit tests, execute:

```
phpunit PATH/TO/PROJECT/tests/
```

If you want code coverage reports, use the following:

```
phpunit --coverage-html ./report PATH/TO/PROJECT/tests/
```

Used PHPUnit default config:

```
phpunit --configuration PATH/TO/PROJECT/phpunit.xml
```

Donating
--------

[](#donating)

You can support this project [here](https://www.paypal.me/cseliseev/10usd). You can also help out by contributing to the project, or reporting bugs. Even voicing your suggestions for features is great. Anything to help is much appreciated.

License
-------

[](#license)

The SESSION CSE HELPERS is open-source PHP library licensed under the MIT license. Please see [License File](https://github.com/cs-eliseev/helpers-session/blob/master/LICENSE.md) for more information.

---

> GitHub [@cs-eliseev](https://github.com/cs-eliseev)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

7

Last Release

2577d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3b9e49d0ce3fd71c8eb31b7c14e48373dbb415a9d16950ce52d23bf89b2ae26?d=identicon)[ak\_eliseev](/maintainers/ak_eliseev)

---

Top Contributors

[![cs-eliseev](https://avatars.githubusercontent.com/u/24221291?v=4)](https://github.com/cs-eliseev "cs-eliseev (89 commits)")

---

Tags

collectioncollectionscseframeworkhelperhelperslibraryphpsessionsessionstooltoolsutilitiesutilityutilsframeworkhelperutilityhelperslibrarytoolcollectioncollectionssessiontoolsutilssessionsutilitiescse

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jbzoo/utils

Collection of PHP functions, mini classes and snippets for everyday developer's routine life.

8321.5M36](/packages/jbzoo-utils)[dragon-code/support

Support package is a collection of helpers and tools for any project.

238.7M101](/packages/dragon-code-support)

PHPackages © 2026

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