PHP code example of awixe / session

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

    

awixe / session example snippets



// Require composer
ootstrap file is iable
app('session')->set('hello', 'world');

// Get a session variable
if (app('session')->get('hello')) {

    // Save result
    $output = [
        app('session')->get('hello')
    ];
}

// Delete a session variable
app('session')->del('hello');

// Print the result
print_r($output);

if (app('session')->get('hello')) {
    print(app('session')->get('hello'));
} else {
    var_dump(app('session')->get('hello'));
}



// Require composer
Handler;

// Not $session = new Handler();

// Set a new session variable
$session->set('hello', 'world');

// Get a session variable
if ($session->get('hello')) {

    // Save result
    $output = [
        $session->get('hello')
    ];
}

// Delete a session variable
$session->del('hello');

// Print the result
print_r($output);

if ($session->get('hello')) {
    print($session->get('hello'));
} else {
    var_dump($session->get('hello'));
}