previewtechs/php-session

PHP Session library with custom handlers

dev-master 2017-03-01 11:59 UTC

This package is auto-updated.

Last update: 2024-11-06 09:16:40 UTC


README

###PHP Session Library

####Usage

<?php
require "vendor/autoload.php";

$pdo = new \PDO("MYSQL_CONNECTION_DSN", "MYSQL_USERNAME", "MYSQL_PASSWORD");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdoHandler = new \Previewtechs\PHPSession\Handler\PDOHandler($pdo);
$handler = new \Previewtechs\PHPSession\Handler\CustomSessionHandler($pdoHandler);
$handler->setHandler();

session_start();
$_SESSION['key'] = "value";

echo $_SESSION['key'];   //will return `value`

PDO Handler has been developed with symfony/http-foundation