PHP Classes
elePHPant
Icontem

Session 7: Store session data in files, PDO, cookie, etc.

Recommend this page to a friend!
  Info   View files Documentation   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-07-02 (21 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
sessionhandlers 1.0BSD License7HTTP, Databases, Files and Folders, U..., P...
Description Author

This package can store session data in files, PDO, cookie, etc..

It can register a session handler that can store and retrieve session data in several types of containers.

Currently it provides drivers that can store data in databases using PDO, Redis, Memcached, files and cookies.

  Performance   Level  
Name: chrys ugwu <contact>
Classes: 3 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 1x

Details

Session PHP(7+)

PHP Session Manager (non-blocking, flash, segment, session encryption). Uses PHP open_ssl for optional encrypt/decryption of session data.

Driver support Scope

file&nbsp;&nbsp;&nbsp;cookie&nbsp;&nbsp;&nbsp;pdo&nbsp;&nbsp;&nbsp;memcached&nbsp;&nbsp;&nbsp;redis&nbsp;&nbsp;&nbsp;[license]()&nbsp;&nbsp;&nbsp;Minimum PHP Version

Installation

You can download the Latest release version as a standalone, alternatively you can use Composer

$ composer require ghostff/session
"require": {
    "ghostff/session": "^1.0"
}

Basic usage:

Registering Error Handler (optional)

#This method must be implemented before Session::start
Session::registerErrorHandler(function($error, $error_code)
{
    #Debug::Log($error);
});

Setting or getting session id :void

#When setting ID, method must be implemented before Session::start
Session::id(bin2hex(random_bytes(32)));

#Get ID
echo Session::id();

Initializing Session

$session = Session::start($optional_session_namespace);

Using Segment :Segment

 $segment = $session->segment($required_segment_name);

Setting Session Data

$session->name = 'foo';
# Setting Segment
$segment->name = 'bar';

# Setting Flash
$session->flash->name = 'foobar';
# Setting Segment Flash
$segment->flash->name = 'barfoo';

$session->commit();

Retrieving Session Data

echo $session->name; # outputs foo
# Retrieving Segment
echo $segment->name; # outputs bar

# Retrieving Flash
echo $session->flash->name; # outputs foobar
# Retrieving Segment Flash
echo $segment->flash->name; # outputs barfoo

Removing Session Data

$session->remove->name;
# Removing Segment
$segment->remove->name;

# Removing Flash
$session->remove->flash->name;
# Removing Segment Flash
$segment->remove->flash->name;

Retrieve all session or segment data :array

$session->all($optional_segment);

Check if variable exist in current session namespace :bool

$session->exist($variable_name, $option_segment, $in_flash);

Removing active session or segment data :void

$session->clear($optional_segment);

Destroying session :void

$session->destroy();

Regenerate session ID :void

$session->rotate($keep_old_session_data);
  Files folder image Files  
File Role Description
Files folder imagesrc (1 file, 1 directory)
Plain text file composer.json Data Auxiliary data
Plain text file LICENSE Lic. License text
Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageSession (3 files, 6 directories)
  Plain text file Session.php Class Class source

  Files folder image Files  /  src  /  Session  
File Role Description
Files folder imageCookie (1 file)
Files folder imageFile (1 file)
Files folder imageMemcached (1 file)
Files folder imagePdo (1 file)
Files folder imageRedis (1 file)
Files folder imagetmp (1 file)
  Plain text file config.php Aux. Auxiliary script
  Plain text file Save.php Class Class source
  Plain text file Segment.php Class Class source

  Files folder image Files  /  src  /  Session  /  Cookie  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files  /  src  /  Session  /  File  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files  /  src  /  Session  /  Memcached  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files  /  src  /  Session  /  Pdo  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files  /  src  /  Session  /  Redis  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files  /  src  /  Session  /  tmp  
File Role Description
  Plain text file sess_gor23cvvn2qmksags74mpurhnq Data Auxiliary data

 Version Control Unique User Downloads  
 100%
Total:0
This week:0