PHP Interface ManaPHP\Http\Session\AdapterInterface

Show file Open project: manaphp/manaphp Interface Usage Examples

Public Methods

Method Description
__construct ( array $options ) AdapterInterface constructor.
clean ( ) : void
close ( ) : boolean The close callback works like a destructor in classes and is executed after the session write callback has been called.
destroy ( string $sessionId ) : boolean This callback is executed when a session is destroyed with session_destroy() or with session_regenerate_id() with the destroy parameter set to TRUE.
gc ( integer $ttl ) : boolean The value of lifetime which is passed to this callback can be set in session.gc_maxlifetime.
open ( string $savePath, string $sessionName ) : boolean The open callback works like a constructor in classes and is executed when the session is being opened.
read ( $sessionId ) : string The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.
write ( string $sessionId, string $data ) : void The write callback is called when the session needs to be saved and closed.

Method Details

__construct() public method

AdapterInterface constructor.
public __construct ( array $options )
$options array

clean() public method

public clean ( ) : void
return void

close() public method

It is also invoked when session_write_close() is called. Return value should be TRUE for success, FALSE for failure.
public close ( ) : boolean
return boolean

destroy() public method

Return value should be TRUE for success, FALSE for failure.
public destroy ( string $sessionId ) : boolean
$sessionId string
return boolean

gc() public method

Return value should be TRUE for success, FALSE for failure.
public gc ( integer $ttl ) : boolean
$ttl integer
return boolean

open() public method

It is the first callback function executed when the session is started automatically or manually with session_start(). Return value is TRUE for success, FALSE for failure.
public open ( string $savePath, string $sessionName ) : boolean
$savePath string
$sessionName string
return boolean

read() public method

The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.
public read ( $sessionId ) : string
$sessionId
return string

write() public method

The serialized session data passed to this callback should be stored against the passed session ID. When retrieving this data, the read callback must return the exact value that was originally passed to the write callback.
public write ( string $sessionId, string $data ) : void
$sessionId string
$data string
return void