PHP Class Webiny\Component\Http\Session

Inheritance: use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\SingletonTrait
ファイルを表示 Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
delete ( string $key ) : boolean Removes the given $key from session.
get ( string $key, mixed $value = null ) : string Get a session value for the given $key.
getAll ( ) : array Get all session values.
getConfig ( ) : ConfigObject Returns session config from Http object.
getSessionId ( ) : string Get current session id.
save ( string $key, mixed $value ) Save, or overwrite, a session value under the given $key with the given $value.

Protected Methods

Method Description
init ( ) Constructor.

Method Details

delete() public method

Removes the given $key from session.
public delete ( string $key ) : boolean
$key string Name of the session key you wish to remove.
return boolean

get() public method

If key doesn't not exist, $value will be returned and assigned under that key.
public get ( string $key, mixed $value = null ) : string
$key string Key for which you wish to get the value.
$value mixed Default value that will be returned if $key doesn't exist.
return string Value of the given $key.

getAll() public method

Get all session values.
public getAll ( ) : array
return array Key-value array of all session entries.

getConfig() public static method

Returns session config from Http object.
public static getConfig ( ) : ConfigObject
return Webiny\Component\Config\ConfigObject

getSessionId() public method

Get current session id.
public getSessionId ( ) : string
return string Session id.

init() protected method

Constructor.
protected init ( )

save() public method

Save, or overwrite, a session value under the given $key with the given $value.
public save ( string $key, mixed $value )
$key string Key for which you wish to get the value.
$value mixed Value that will be stored under the $key.