PHP code example of ligne / session

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

    

ligne / session example snippets


$session = new SessionsController();

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

$session->set('foo','bar')
        ->set('last_activity', date('Y-m-d h:i:s') )
	->set('user_id','1');

$session->get('foo');
#out
'bar'

$session->remove('foo');

$session->remove('foo')
        ->remove('user_id');

$session->destroy_all_session();

$session->id(); 		//Retorna el ID de la sesión actual
$session->get_all(); 		// Retorna un array con todas las sesiones existentes