2017 © Pedro Peláez
 

library session

A simple wrapper around common session_* functionality in the Standard PHP Library

image

helgesverre/session

A simple wrapper around common session_* functionality in the Standard PHP Library

  • Wednesday, October 28, 2015
  • by HelgeSverre
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Session

Latest Version on Packagist ![Software License][ico-license] Total Downloads, (*1)

This is a very simple around common session_* functions in the Standard PHP Library, created for no other purpose than to give a more "OOP"-feely way to get and set session variables, with some added convenciences like built-in checking if a key exists and such., (*2)

Install

Via Composer, (*3)

``` bash $ composer require helgesverre/session, (*4)


## Requirements - PHP 5.6.0 >= ## Usage ```php <?php require 'vendor/autoload.php'; use Helge\Session\Session; /** * Start a session, you can specify the session_name, session_id and session_cache_limiter * when starting a session since these need to be set before the session is actually started. * returns true if the session is started successfully, false if not. */ Session::start($name = null, $id = null, $cacheLimiter = null); /** * returns true if the session is started, false if not. */ Session::isStarted(); /** * Returns the status of the session which is an INT that maps to these constants: * - PHP_SESSION_DISABLED if sessions are disabled. * - PHP_SESSION_NONE if sessions are enabled, but none exists. * - PHP_SESSION_ACTIVE if sessions are enabled, and one exists. */ Session::status(); /** * Gets or sets the type of cache HTTP Headers are sent to the client * More information: http://php.net/manual/en/function.session-cache-limiter.php * returns the the current cache limiter as a string */ Session::cacheLimiter($cacheLimiter = null); /** * gets or sets the session save path, if you want to change the path where sessions * are stored, this must be called BEFORE a session is started */ Session::savePath($path = null); /** * Sets the $_SESSION[$key] variable to $value */ Session::set($key, $value); /** * Returns $_SESSION[$key] if it exists, false if not. */ Session::get($key); /** * does unset($_SESSION[$key]) if the key exists */ Session::delete($key); /** * Sets the name of the session or returns the name of the current session if no params are passed. */ Session::name($name = null); /** * Clears the session by calling session_unset() */ Session::clear(); /** * Discards the session array and finishes the session */ Session::abort(); /** * Resets the session with the values that are in the session store, the current session data is discarded */ Session::reset(); /** * Closes the session and (if chosen) writes session data to the session save path. */ Session::close($save = true); /** * Returns the serialized session data, example: username|s:11:"helgesverre";password|s:11:"password123"; */ Session::encode(); /** * Takes serialized session data and populates the $_SESSION variable with them. */ Session::decode($data); /** * Get and/or set the current session id */ Session::id($id = null);

License

The MIT License (MIT). Please see License File for more information., (*5)

The Versions

28/10 2015

dev-master

9999999-dev https://github.com/helgesverre/session

A simple wrapper around common session_* functionality in the Standard PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

wrapper session

28/10 2015

1.1.0

1.1.0.0 https://github.com/helgesverre/session

A simple wrapper around common session_* functionality in the Standard PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

wrapper session

28/10 2015

1.0.0

1.0.0.0 https://github.com/helgesverre/session

A simple wrapper around common session_* functionality in the Standard PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

wrapper session helgesverre helge sverre