Skip to content

🍤 Caridea is a miniscule PHP application library. This is a shrimpy session component.

License

Notifications You must be signed in to change notification settings

libreworks/caridea-session

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Packagist Build Status Scrutinizer Code Quality Code Coverage

Installation

You can install this library using Composer:

$ 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.

Our code is intended to comply with PSR-1, PSR-2, and PSR-4. If you find any issues related to standards compliance, please send a pull request!

Documentation

Examples

Just a few quick examples.

Creating a Session.

// 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';

About

🍤 Caridea is a miniscule PHP application library. This is a shrimpy session component.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages