Class NSession
Provides access to session namespaces as well as session settings and management methods.
- NObject
-
NSession
public
void
|
#
start(
)
Starts and initializes session data. |
public
bool
|
#
isStarted(
)
Has been session started? Has been session started? |
public
void
|
#
close(
)
Ends the current session and store session data. Ends the current session and store session data. |
public
void
|
#
destroy(
)
Destroys all data registered to a session. Destroys all data registered to a session. |
public
bool
|
#
exists(
)
Does session exists for the current request? Does session exists for the current request? |
public
void
|
#
regenerateId(
)
Regenerates the session ID. |
public
string
|
#
getId(
)
Returns the current session ID. Don't make dependencies, can be changed for each request. Returns the current session ID. Don't make dependencies, can be changed for each request. |
public
NSession
|
#
setName(
string
$name
)
Sets the session name to a specified one. Sets the session name to a specified one. Parameters$name stringReturnsNSession provides a fluent interface
|
public
string
|
#
getName(
)
Gets the session name. Gets the session name. |
public
NSessionNamespace
|
#
getNamespace(
string
$namespace,
string
$class = 'NSessionNamespace'
)
Returns specified session namespace. Returns specified session namespace. Parameters$namespace string$class stringThrows |
public
bool
|
#
hasNamespace(
string
$namespace
)
Checks if a session namespace exist and is not empty. Checks if a session namespace exist and is not empty. Parameters$namespace string |
public
ArrayIterator
|
#
getIterator(
)
Iteration over all namespaces. Iteration over all namespaces. |
public
void
|
#
clean(
)
Cleans and minimizes meta structures. Cleans and minimizes meta structures. |
public
NSession
|
#
setOptions(
array
$options
)
Sets session options. Sets session options. Parameters$options arrayReturnsNSession provides a fluent interface
Throws |
public
array
|
#
getOptions(
)
Returns all session options. Returns all session options. |
public
NSession
|
#
setExpiration(
string|int|DateTime
$time
)
Sets the amount of time allowed between requests before the session will be terminated. Sets the amount of time allowed between requests before the session will be terminated. Parameters$time string|int|DateTime time, value 0 means "until the browser is closed"ReturnsNSession provides a fluent interface
|
public
NSession
|
#
setCookieParams(
string
$path,
string
$domain = NULL,
bool
$secure = NULL
)
Sets the session cookie parameters. Sets the session cookie parameters. Parameters$path string path$domain string domain$secure bool secureReturnsNSession provides a fluent interface
|
public
array
|
#
getCookieParams(
)
Returns the session cookie parameters. Returns the session cookie parameters. Returnsarray containing items: lifetime, path, domain, secure, httponly
|
public
NSession
|
#
setSavePath(
$path
)
Sets path of the directory used to save session data. Sets path of the directory used to save session data. ReturnsNSession provides a fluent interface
|
protected
IHttpRequest
|
#
getHttpRequest(
)
|
protected
IHttpResponse
|
#
getHttpResponse(
)
|
Methods Inherited From NObject
getReflection(), __call(), __callStatic(), extensionMethod(), __get(), __set(), __isset(), __unset()
DEFAULT_FILE_LIFETIME |
10800 # |