PHP code example of brdev / sessions

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

    

brdev / sessions example snippets





use BRdev\Sessions\Session;

ssions/");

if(false){
    //SESSION REGENERATE
    $session->regenerate();
}

if(false){
    //SET KEY
    $session->set("name","luciano");

    //GET SESSION
    echo $session->name;
}


if(false){
    //HAS KEY
    if($session->has("name")){
        echo $session->name;
        return;
    }

    $session->set("name","luciano");
    //GET SESSION
    echo $session->name;
}

if(false){
    //HAS KEY
    if($session->has("name")){
        echo $session->name;
    }
}

if(false){
    //SESSION DESTROY
    $session->destroy();
}

if(false){
    //SESSION DELETE SET
    $session->unset("name");
}

if(true)
{
    //SESSION CSRF
    $session->csrf();
    echo $session->csrf_token;
}