class FluentSession extends Session (View source)

Because there is not always an active controller (such as during pre-request filters) FluentSession will ensure the correct session object is injected as necessary

Properties

protected $data

Session data

from  Session
protected $changedData from  Session
protected static $default_session from  Session
protected static Session $old_session

Current session

Methods

protected
userAgent()

No description

from  Session
public
__construct($data)

Start PHP session, then create a new Session object with the given start data.

from  Session
public static 
set_cookie_domain(string $domain) deprecated

Cookie domain, for example 'www.php.net'.

from  Session
public static 
string
get_cookie_domain() deprecated

Get the cookie domain.

from  Session
public static 
set_cookie_path(string $path) deprecated

Path to set on the domain where the session cookie will work.

from  Session
public static 
string
get_cookie_path() deprecated

Get the path on the domain where the session cookie will work.

from  Session
public static 
set_cookie_secure(bool $secure) deprecated

Secure cookie, tells the browser to only send it over SSL.

from  Session
public static 
bool
get_cookie_secure() deprecated

Get if the cookie is secure

from  Session
public static 
set_session_store_path(string $path) deprecated

Set the session store path

from  Session
public static 
string
get_session_store_path() deprecated

Get the session store path

from  Session
public static 
set_timeout_ips($ips) deprecated

Provide an array of rules specifing timeouts for IPv4 address ranges or individual IPv4 addresses. The key is an IP address or range and the value is the time until the session expires in seconds. For example:

from  Session
public static 
add_to_array($name, $val)

Add a value to a specific key in the session array

from  Session
public static 
set(string $name, string $val)

Set a key/value pair in the session

from  Session
public static 
get(string $name)

Return a specific value by session key

from  Session
public static 
array
get_all()

Return all the values in session

from  Session
public static 
clear(string $name)

Clear a given session key, value pair.

from  Session
public static 
void
clear_all()

Clear all the values

from  Session
public static 
save()

Save all the values in our session to $_SESSION

from  Session
protected static 
current_session()

No description

from  Session
public
inst_start($sid = null)

No description

from  Session
public
inst_destroy($removeCookie = true)

No description

from  Session
public
inst_set($name, $val)

No description

from  Session
public
inst_addToArray($name, $val)

No description

from  Session
public
inst_get($name)

No description

from  Session
public
inst_clear($name)

No description

from  Session
public
inst_clearAll()

No description

from  Session
public
inst_getAll()

No description

from  Session
public
inst_finalize()

No description

from  Session
public
inst_save()

Save data to session Only save the changes, so that anyone manipulating $_SESSION directly doesn't get burned.

from  Session
protected
recursivelyApply($data, $dest)

Recursively apply the changes represented in $data to $dest.

from  Session
public
array
inst_changedData()

Return the changed data, for debugging purposes.

from  Session
public static 
setFormMessage(string $formname, string $message, string $type)

Sets the appropriate form message in session, with type. This will be shown once, for the form specified.

from  Session
public static 
bool
request_contains_session_id()

Is there a session ID in the request?

from  Session
public static 
start(string $sid = null)

Initialize session.

from  Session
public static 
destroy(bool $removeCookie = true)

Destroy the active session.

from  Session
public static 
set_timeout(int $timeout) deprecated

Set the timeout of a Session value

from  Session
public static 
get_timeout() deprecated

No description

from  Session
public static 
with_session(Session $session, $callback)

Allows session to be temporarily injected into default_session prior to the existence of a controller

Details

protected userAgent()

No description

__construct($data)

Start PHP session, then create a new Session object with the given start data.

Parameters

$data

array|Session Can be an array of data (such as $_SESSION) or another Session object to clone.

deprecated 4.0 Use the "Session.cookie_domain" config setting instead

Cookie domain, for example 'www.php.net'.

To make cookies visible on all subdomains then the domain must be prefixed with a dot like '.php.net'.

Parameters

string $domain

The domain to set

deprecated 4.0 Use the "Session.cookie_domain" config setting instead

Get the cookie domain.

Return Value

string

deprecated 4.0 Use the "Session.cookie_path" config setting instead

Path to set on the domain where the session cookie will work.

Use a single slash ('/') for all paths on the domain.

Parameters

string $path

The path to set

deprecated 4.0 Use the "Session.cookie_path" config setting instead

Get the path on the domain where the session cookie will work.

Return Value

string

deprecated 4.0 Use the "Session.cookie_secure" config setting instead

Secure cookie, tells the browser to only send it over SSL.

Parameters

bool $secure

deprecated 4.0 Use the "Session.cookie_secure" config setting instead

Get if the cookie is secure

Return Value

bool

static set_session_store_path(string $path) deprecated

deprecated 4.0 Use the "Session.session_store_path" config setting instead

Set the session store path

Parameters

string $path

Filesystem path to the session store

static string get_session_store_path() deprecated

deprecated since version 4.0

Get the session store path

Return Value

string

static set_timeout_ips($ips) deprecated

deprecated 4.0 Use the "Session.timeout_ips" config setting instead

Provide an array of rules specifing timeouts for IPv4 address ranges or individual IPv4 addresses. The key is an IP address or range and the value is the time until the session expires in seconds. For example:

Session::set_timeout_ips(array( '127.0.0.1' => 36000 ));

Any user connecting from 127.0.0.1 (localhost) will have their session expired after 10 hours.

Session::set_timeout is used to set the timeout value for any users whose address is not in the given IP range.

Parameters

$ips

static add_to_array($name, $val)

Add a value to a specific key in the session array

Parameters

$name
$val

static set(string $name, string $val)

Set a key/value pair in the session

Parameters

string $name Key
string $val Value

static get(string $name)

Return a specific value by session key

Parameters

string $name

Key to lookup

static array get_all()

Return all the values in session

Return Value

array

static clear(string $name)

Clear a given session key, value pair.

Parameters

string $name

Key to lookup

static void clear_all()

Clear all the values

Return Value

void

static save()

Save all the values in our session to $_SESSION

static protected current_session()

No description

inst_start($sid = null)

No description

Parameters

$sid

inst_destroy($removeCookie = true)

No description

Parameters

$removeCookie

inst_set($name, $val)

No description

Parameters

$name
$val

inst_addToArray($name, $val)

No description

Parameters

$name
$val

inst_get($name)

No description

Parameters

$name

inst_clear($name)

No description

Parameters

$name

inst_clearAll()

No description

inst_getAll()

No description

inst_finalize()

No description

inst_save()

Save data to session Only save the changes, so that anyone manipulating $_SESSION directly doesn't get burned.

protected recursivelyApply($data, $dest)

Recursively apply the changes represented in $data to $dest.

Used to update $_SESSION

Parameters

$data
$dest

array inst_changedData()

Return the changed data, for debugging purposes.

Return Value

array

static setFormMessage(string $formname, string $message, string $type)

Sets the appropriate form message in session, with type. This will be shown once, for the form specified.

Parameters

string $formname

the form name you wish to use ( usually $form->FormName() )

string $message

the message you wish to add to it

string $type

the type of message

static bool request_contains_session_id()

Is there a session ID in the request?

Return Value

bool

static start(string $sid = null)

Initialize session.

Parameters

string $sid

Start the session with a specific ID

static destroy(bool $removeCookie = true)

Destroy the active session.

Parameters

bool $removeCookie

If set to TRUE, removes the user's cookie, FALSE does not remove

static set_timeout(int $timeout) deprecated

deprecated 4.0 Use the "Session.timeout" config setting instead

Set the timeout of a Session value

Parameters

int $timeout

Time until a session expires in seconds. Defaults to expire when browser is closed.

static get_timeout() deprecated

deprecated 4.0 Use the "Session.timeout" config setting instead

No description

static with_session(Session $session, $callback)

Allows session to be temporarily injected into default_session prior to the existence of a controller

Parameters

Session $session
$callback