PHP code example of madeorsk / session

1. Go to this page and download the library: Download madeorsk/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/ */

    

madeorsk / session example snippets



use Session\Session;

// Initialize session.
$session = new Session();

$session->write("name", "this is a text value"); // Save "this is a text value" in the session.

// ...

echo $session->read("name"); // Will echo "this is a text value".
echo $session->read("undefined_name", "my default value"); // Will echo "my default value".

// ...

$value = $session->delete("name"); // Delete the value of the session variable "name" in the session and return it.