PHP code example of gobline / session

1. Go to this page and download the library: Download gobline/session library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gobline / session example snippets


$session = new Gobline\Session\NamespacedSession('MyNamespace');

$session->set('foo', 'bar');

$session->get('foo'); // returns "bar"

$session->get('corge'); // "corge" not found, throws \InvalidArgumentException

$session->get('corge', 'grault'); // "corge" not found, returns default "grault" value

$session->remove('foo');

$session->clearAll(); // removes all session variables from "MyNamespace" namespace

$session->setNamespace('AnotherNamespace'); // switch namespace