Skip to content

Latest commit

 

History

History
executable file
·
45 lines (32 loc) · 900 Bytes

Server Session.md

File metadata and controls

executable file
·
45 lines (32 loc) · 900 Bytes

Session

Sessions start automatically when injected.

<?php
use CatPaw\Web\Interfaces\ServerInterface;

function(SessionInterface $session){
    // Session has now started.
    return $session->id();
}

Modify Session

Session contents are mutable and can be modified by reference.

<?php
use CatPaw\Web\Interfaces\ServerInterface;

function(SessionInterface $session){
    $username = &$session->ref('username');
    $username = "John";
}

Destroy Session

use CatPaw\Web\Interfaces\ServerInterface;

function(SessionInterface $session){
    $session->destroy();
    // Any changes to the session below this point will be lost.
}

Restart Session

Sessions restart automatically when they expire.
There is no direct mechanism for restarting a session.

In order to restart the session of a client, you must destroy that client's session.