PHPackages                             buimatic/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. [Security](/categories/security)
4. /
5. buimatic/session

ActiveLibrary[Security](/categories/security)

buimatic/session
================

Based on aura/session

2.0.1(11y ago)019BSD-2-ClausePHPPHP &gt;=5.3.0

Since May 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/buimatic/Aura.Session)[ Packagist](https://packagist.org/packages/buimatic/session)[ Docs](https://github.com/auraphp/Aura.Session)[ RSS](/packages/buimatic-session/feed)WikiDiscussions 2.x Synced 1mo ago

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

Aura Session
============

[](#aura-session)

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

Foreword
--------

[](#foreword)

### Installation

[](#installation)

This library requires PHP 5.3 or later; we recommend using the latest available version of PHP as a matter of principle. It has no userland dependencies.

It is installable and autoloadable via Composer as [aura/session](https://packagist.org/packages/aura/session).

Alternatively, [download a release](https://github.com/auraphp/Aura.Session/releases) or clone this repository, then require or include its *autoload.php* file.

### Quality

[](#quality)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/acc9c92951510d062a15b71c1b57f04bffce46769684aef76c21e17fabac1667/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f617572617068702f417572612e53657373696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f702d32)](https://scrutinizer-ci.com/g/auraphp/Aura.Session/)[![Code Coverage](https://camo.githubusercontent.com/4f2eb6a7d71b1b68e44d455ddf630066faa638ec1cc4439a7d300565778e9f98/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f617572617068702f417572612e53657373696f6e2f6261646765732f636f7665726167652e706e673f623d646576656c6f702d32)](https://scrutinizer-ci.com/g/auraphp/Aura.Session/)[![Build Status](https://camo.githubusercontent.com/42ab7910c6de056ccb5bb209d7944460e14319026063c165dfea1503463cb864/68747470733a2f2f7472617669732d63692e6f72672f617572617068702f417572612e53657373696f6e2e706e673f6272616e63683d646576656c6f702d32)](https://travis-ci.org/auraphp/Aura.Session)

To run the unit tests at the command line, issue `composer install` and then `phpunit` at the package root. This requires [Composer](http://getcomposer.org/) to be available as `composer`, and [PHPUnit](http://phpunit.de/manual/) to be available as `phpunit`.

This library attempts to comply with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

### Community

[](#community)

To ask questions, provide feedback, or otherwise communicate with the Aura community, please join our [Google Group](http://groups.google.com/group/auraphp), follow [@auraphp on Twitter](http://twitter.com/auraphp), or chat with us on #auraphp on Freenode.

Getting Started
---------------

[](#getting-started)

### Instantiation

[](#instantiation)

The easiest way to get started is to use the *SessionFactory* to create a *Session* manager object.

```

```

We can then use the *Session* instance to create *Segment* objects to manage session values and flashes. (In general, we should not need to manipulate the *Session* manager directly -- we will work mostly with *Segment* objects.)

### Segments

[](#segments)

In normal PHP, we keep session values in the `$_SESSION` array. However, when different libraries and projects try to modify the same keys, the resulting conflicts can result in unexpected behavior. To resolve this, we use *Segment* objects. Each *Segment* addresses a named key within the `$_SESSION` array for deconfliction purposes.

For example, if we get a *Segment* for `Vendor\Package\ClassName`, that *Segment* will contain a reference to `$_SESSION['Vendor\Package\ClassName']`. We can then `set()` and `get()` values on the *Segment*, and the values will reside in an array under that reference.

```
