CookieEnabledInterface
interface CookieEnabledInterface implements SessionInterface (View source)
Interface for Sessions that are related to a cookie.
Methods
Returns true if there is a session that can be resumed. false otherwise
Generates and propagates a new session ID and transfers all existing data to the new session.
Returns the content (mixed) associated with the given key.
Stores the given data under the given key in the session
Returns the unix time stamp marking the last point in time this session has been in use.
Remove data of all sessions which are considered to be expired.
No description
No description
Details
bool
isStarted()
Tells if the session has been started already.
void
start()
Starts the session, if is has not been already started
bool
canBeResumed()
Returns true if there is a session that can be resumed. false otherwise
void
resume()
Resumes an existing session, if any.
string
getId()
Returns the current session ID.
string
renewId()
Generates and propagates a new session ID and transfers all existing data to the new session.
Renewing the session ID is one counter measure against Session Fixation Attacks.
mixed
getData(string $key)
Returns the content (mixed) associated with the given key.
bool
hasKey(string $key)
Returns true if $key is available.
void
putData(string $key, mixed $data)
Stores the given data under the given key in the session
void
addTag(string $tag)
Tags this session with the given tag.
Note that third-party libraries might also tag your session. Therefore it is recommended to use namespaced tags such as "Acme-Demo-MySpecialTag".
void
removeTag(string $tag)
Removes the specified tag from this session.
array
getTags()
Returns the tags this session has been tagged with.
void
touch()
Updates the last activity time to "now".
int
getLastActivityTimestamp()
Returns the unix time stamp marking the last point in time this session has been in use.
For the current (local) session, this method will always return the current time. For a remote session, the unix timestamp will be returned.
void
close()
Explicitly writes (persists) and closes the session
void
destroy(string $reason = null)
Explicitly destroys all session data
int
collectGarbage()
Remove data of all sessions which are considered to be expired.
Cookie
getSessionCookie()
No description
static CookieEnabledInterface|SessionInterface
createFromCookieAndSessionInformation(Cookie $sessionCookie, string $storageIdentifier, int $lastActivityTimestamp, array $tags = [])
No description