PHPackages                             codezero/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. codezero/session

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

codezero/session
================

Manage session data.

1.0.0(11y ago)02.8kMITPHPPHP &gt;=5.4.0

Since Mar 30Pushed 11y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Session
=======

[](#session)

![GitHub release](https://camo.githubusercontent.com/51c37eedc317599cfd2d1979c60dcff0eb8134b384d2611a920c4a151bb414a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f64657a65726f2d62652f73657373696f6e2e737667)![License](https://camo.githubusercontent.com/cdc88f7ec9d3312ac5bb16fc1312d6faf45976a4c3a9af046d291bbaeb53a80b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f64657a65726f2f73657373696f6e2e737667)[![Build Status](https://camo.githubusercontent.com/93fb490570c035ab89213a8d9354a6c7438dc0c4b75b9c0f29ab51ccb5dd21a7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f64657a65726f2d62652f73657373696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/codezero-be/session)[![Scrutinizer](https://camo.githubusercontent.com/551d6a330175889a715e4dd710a1dbba7d553e441bdbbbbfc2123930a3e40b08/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f64657a65726f2d62652f73657373696f6e2e737667)](https://scrutinizer-ci.com/g/codezero-be/session)[![Total Downloads](https://camo.githubusercontent.com/f65b520deec3c61384de88a9c085cbba5aa436327649226458a0986d9bb32539/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64657a65726f2f73657373696f6e2e737667)](https://packagist.org/packages/codezero/session)

### Manage session data.

[](#manage-session-data)

This package includes an adapter for Laravel's [`Session Store`](http://laravel.com/docs/5.0/session), to enable the use of other implementations in non-Laravel projects.

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

[](#installation)

Install this package through Composer:

```
composer require codezero/session

```

Vanilla PHP Implementation
--------------------------

[](#vanilla-php-implementation)

Autoload the vendor classes:

```
require_once 'vendor/autoload.php'; // Path may vary

```

And then use the `VanillaSession` implementation:

```
$session = new \CodeZero\Session\VanillaSession();

```

Laravel 5 Implementation
------------------------

[](#laravel-5-implementation)

Add a reference to `LaravelSessionServiceProvider` to the providers array in `config/app.php`:

```
'providers' => [
    'CodeZero\Session\LaravelSessionServiceProvider'
]

```

Then you can "make" (or inject) a `Cookie` instance anywhere in your app:

```
$session = \App::make('CodeZero\Session\Session');

```

> **TIP:** Laravel's [IoC container](http://laravel.com/docs/5.0/container) will automatically provide the Laravel specific `Session` implementation. This will use Laravel's [`Session`](http://laravel.com/docs/5.0/session) goodness behind the scenes!

Usage
-----

[](#usage)

### Store data in the session

[](#store-data-in-the-session)

```
$session->store('key', 'value');
$session->store('key', ['array' => 'value']);

```

### Get session data

[](#get-session-data)

If a key doesn't exist, `null` will be returned.

```
$array = $session->get(); // An array of all data
$value = $session->get('key'); // Specific data

```

### Delete session data

[](#delete-session-data)

```
$session->flush(); // Clear all data
$session->delete('key'); // Clear specific data

```

### Destroy the session

[](#destroy-the-session)

This will flush all data and regenerate the session ID.

```
$session->destroy();

```

Testing
-------

[](#testing)

```
$ vendor/bin/phpspec run

```

Security
--------

[](#security)

If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

---

[![Analytics](https://camo.githubusercontent.com/fc4dd2f253a865ca54945272c7c9c25437441bc7e869020a7b70b6939ff191de/68747470733a2f2f67612d626561636f6e2e61707073706f742e636f6d2f55412d35383837363031382d312f636f64657a65726f2d62652f73657373696f6e)](https://github.com/igrigorik/ga-beacon)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4090d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e17b7a892452367dfb0e5c55bf04844a16bb781f356f50019332d4b9a476ec6?d=identicon)[codezero](/maintainers/codezero)

---

Top Contributors

[![ivanvermeyen](https://avatars.githubusercontent.com/u/3598622?v=4)](https://github.com/ivanvermeyen "ivanvermeyen (3 commits)")

---

Tags

phplaravelsession

### Embed Badge

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

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

###  Alternatives

[amranidev/laracombee

Recommendation system for laravel

11537.9k1](/packages/amranidev-laracombee)[yieldstudio/tailwind-merge-php

Merge Tailwind CSS classes without style conflicts

4974.6k1](/packages/yieldstudio-tailwind-merge-php)[salmanzafar/laravel-geocode

A Laravel Library to find Lat and Long of a given Specific Address

154.3k](/packages/salmanzafar-laravel-geocode)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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