https://github.com/libreworks/caridea-session
:fried_shrimp: Caridea is a miniscule PHP application library. This is a shrimpy session component.
https://github.com/libreworks/caridea-session
Last synced: about 1 year ago
JSON representation
:fried_shrimp: Caridea is a miniscule PHP application library. This is a shrimpy session component.
- Host: GitHub
- URL: https://github.com/libreworks/caridea-session
- Owner: libreworks
- License: apache-2.0
- Created: 2015-06-03T16:03:16.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-01-06T20:45:42.000Z (over 8 years ago)
- Last Synced: 2025-02-03T21:47:34.631Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# caridea-session
Caridea is a miniscule PHP application library. This shrimpy fellow is what you'd use when you just want some helping hands and not a full-blown framework.

This is the session component. It's used for controlling sessions (e.g. starting, resuming, destroying) as well as storing namespaced values within a session.
It supports plugins that get notified of session events. Included in this package are a CSRF prevention plugin and a "flash message" plugin.
[](https://packagist.org/packages/caridea/session)
[](https://travis-ci.org/libreworks/caridea-session)
[](https://scrutinizer-ci.com/g/libreworks/caridea-session/?branch=master)
[](https://scrutinizer-ci.com/g/libreworks/caridea-session/?branch=master)
## Installation
You can install this library using Composer:
```console
$ composer require caridea/session
```
* The master branch (version 3.x) of this project requires PHP 7.1 and has no dependencies
* Version 2.x of this project requires PHP 7.0 and has no dependencies
* Version 1.x of this project requires PHP 5.5 and depends on `caridea/random`.
## Compliance
Releases of this library will conform to [Semantic Versioning](http://semver.org).
Our code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), and [PSR-4](http://www.php-fig.org/psr/psr-4/). If you find any issues related to standards compliance, please send a pull request!
## Documentation
* Head over to [Read the Docs](http://caridea-session.readthedocs.io/en/latest/)
## Examples
Just a few quick examples.
Creating a Session.
```php
// When the session starts, a CSRF token will be created and stored
$csrf = new \Caridea\Session\CsrfPlugin();
// Display-once messages can be added using the flash plugin
$flash = new \Caridea\Session\FlashPlugin();
$session = new \Caridea\Session\NativeSession($_COOKIE, [$csrf, $flash]);
$session->resume() || $session->start();
$flash->set('foo', 'bar');
$token = $csrf->getValue();
$values = $session->getValues('my-namespace');
$values['foobar'] = 'abc123';
```