PHP code example of 00f100 / fcphp-session

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

    

00f100 / fcphp-session example snippets



use FcPhp\Session\Facades\SessionFacade;

/**
 * Method to return instance of Session 
 *
 * @param array $cookies Cookies default
 * @param string $nonce Nonce to use 00f100/fcphp-crypto
 * @param string $pathKeys Path to save crypto-keys
 * @return void
 */
SessionFacade::getInstance(array $cookies, string $nonce = null, string $pathKeys = null);


// Start session and load cache

$nonce = '...';
$pathKeys = 'var/crypto/keys';

// Use Cache into file
$sessionFile = SessionFacade::getInstance($_COOKIE, $nonce, $pathKeys);

// Create new configuration
$sessionRedis->set('item.config', 'value');

// Print: value
echo $sessionRedis->get('item.config');

/*
Return: 
Array (
    'item' => Array(
        'config' => 'value'
    )
)
*/
print_r($sessionRedis->get());

// Save into Cookie
$sessionRedis->commit();