1. Go to this page and download the library: Download victory7/ezsession 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/ */
victory7 / ezsession example snippets
use Ezsession\Ezsession;
// Initialize Ezsession with your Redis and MySQL configuration
$sessionHandler = new Ezsession(
[
'redis' => [
'host' => '127.0.0.1',
'port' => 6379,
],
'mysql' => [
'host' => '127.0.0.1',
'username' => 'root',
'password' => '',
'database' => 'ezsession_db',
],
'jwt_secret' => 'your_secret_key_here',
]
);
session_set_save_handler($sessionHandler, true);
session_start();
// Example usage
$_SESSION['user_id'] = 123;
$_SESSION['username'] = 'john_doe';
$_SESSION['jwt']['user_id'] = 'aaBBcc1212';
// Adding custom data to JWT
$_SESSION['jwt']['role'] = 'admin';
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.