Fork me on GitHub

The sessions


Jaxon provides a simple API for sessions management.

The implementation

The current session management implementation in Jaxon uses the PHP session functions.

The usage and the API

A call to jaxon()->session() returns the session manager.

    $sessionId = $this->session()->getId();

The following methods are available.

  • Get the current session id.
    public function getId()
  • Generate a new session id.
    public function newId($bDeleteData = false)
  • Save data in the session.
    public function set($sKey, $xValue)
  • Save data in the session, that will be available only until the next request.
    public function flash($sKey, $xValue)
  • Check if a session key exists.
    public function has($sKey)
  • Get data from the session.
    public function get($sKey, $xDefault = null)
  • Get all data in the session.
    public function all()
  • Delete a session key and its data.
    public function delete($sKey)
  • Delete all data in the session.
    public function clear()
  • Delete the session and all its data.
    public function destroy()