2017 © Pedro Peláez
 

library session

A simple session class

image

hub20xx/session

A simple session class

  • Tuesday, January 5, 2016
  • by hub20xx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Session

Build Status, (*1)

A simple session class., (*2)

Install

Via Composer, (*3)

$ composer require hub20xxx/session

Usage

You can use the class to store / retrieve anything that can be stored in a php session., (*4)

// Forget about session_start():
//   - current session left alone if present
//   - new session started if no session present
$session = new \hub20xxx\Session\Session;

// Checking the existence of a session variable
$session->exists('variable'); // returns a boolean

// Setting session variables
$session->set('myString', 'stringy string');
$session->set('myArray', ['key' => 'value', 'otherKey' => 'otherValue']);
$session->set('myClass', new StdClass);

// Getting values of session variables
$mySessionString = $session->get('myString');
$mySessionArray = $session->get('myArray');
$mySessionClass = $session->get('myClass');

// Deleting session variables
$session->delete('myString');
$session->delete('myArray');
$session->delete('myClass');

// Flashing session variables
// 1. Setting the session variable (you can use the set method as well)
$session->flash('myFlashString', 'stringy string');
$session->flash('myFlashArray', ['key' => 'value', 'otherKey' => 'otherValue']);
$session->flash('myFlashClass', new StdClass);

// 2. Getting values of session variables and deleting them
$myFlashString = $session->flash('myFlashString');
$myFlashArray = $session->flash('myFlashArray');
$myFlashClass = $session->flash('myFlashClass');

Testing

$ phpunit

License

MIT, (*5)

Credits / Thanks

This package was inpired (among others) by:, (*6)

Many thanks to them :), (*7)

Contributing

If you'd like to contribute, please use Github (issues, pull requests etc)., (*8)

The Versions

05/01 2016

dev-master

9999999-dev

A simple session class

  Sources   Download

MIT

The Development Requires

by Avatar hub20xx

session flash

05/01 2016

0.2.0

0.2.0.0

A simple session class

  Sources   Download

MIT

The Development Requires

by Avatar hub20xx

session flash

05/01 2016

0.1.0

0.1.0.0

A simple session class

  Sources   Download

MIT

The Development Requires

by Avatar hub20xx

session flash