Session

Represents a browser session.

Sessions persist between HTTP requests for a single browser session. They are deleted when the browser is closed, or they time-out. Session cookies are used to maintain sessions using a secure UUID.

Sessions can be used to maintain data for a browser session, e.g. a shopping basket.

The context must have first been routed to a @see \io\vertx\jphp\ext\web\handler\SessionHandler for sessions to be available.

package

Default

Methods

__construct

__construct() 

Destroy the session

destroy() : void

Get some data from the session

get( $arg0) : mixed

Arguments

$arg0

string

Response

mixed

the data

id

id() : string

Response

string

The unique ID of the session. This is generated using a random secure UUID.

isDestroyed

isDestroyed() : boolean

Response

boolean

has the session been destroyed?

isEmpty

isEmpty() : boolean

Response

boolean

true if the session has data

isRegenerated

isRegenerated() : boolean

Response

boolean

has the session been renewed?

lastAccessed

lastAccessed() : integer

Response

integer

the time the session was last accessed

oldId

oldId() : string

Response

string

old ID if renewed

Put some data in a session

put( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

mixed

Response

$this

a reference to this, so the API can be used fluently

regenerateId

regenerateId() : \io\vertx\jphp\ext\web\Session

Response

\io\vertx\jphp\ext\web\Session

The new unique ID of the session.

Remove some data from the session

remove( $arg0) : mixed

Arguments

$arg0

string

Response

mixed

the data that was there or null if none there

Mark the session as being accessed.

setAccessed() : void

timeout

timeout() : integer

Response

integer

the amount of time in ms, after which the session will expire, if not accessed.

The short representation of the session to be added to the session cookie. By default is the session id.

value() : string

Response

string

short representation string.