2017 © Pedro Peláez
 

library php-mysql-session-handler

MySQL PHP Session Handler

image

jamiecressey/php-mysql-session-handler

MySQL PHP Session Handler

  • Wednesday, October 7, 2015
  • by jayc89
  • Repository
  • 1 Watchers
  • 12 Stars
  • 182 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

PHP MySQL Session Handler

Latest Stable Version Total Downloads Bitdeli Badge, (*1)

This repository contains a custom PHP session handler using MySQL as a backend. The class has been tested successfully using PHP-FPM and HHVM. To get started, it is recommended, although not required, this class is used in conjunction with PHP-MySQL-PDO-Database-Class., (*2)

How to Install

using Composer

Create a composer.json file in your project root:, (*3)

{
    "require": {
        "jamiecressey/php-mysql-session-handler": "dev-master"
    }
}

Then run the following composer command:, (*4)

$ php composer.phar install

How to use

CREATE TABLE IF NOT EXISTS `sessions` (
    `id` varchar(32) NOT NULL,
    `timestamp` int(10) unsigned DEFAULT NULL,
    `data` mediumtext,
    PRIMARY KEY (`id`),
    KEY `timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

require 'vendor/autoload.php';
$handler = new \JamieCressey\SessionHandler\SessionHandler();

// Pass DB details to create a new MySQLi connection
$handler->setDbDetails('localhost', 'username', 'password', 'database');
// OR alternatively, inject an existing MySQLi resource
// $db = new Db(); // See: https://github.com/jamiecressey/php-mysql-pdo-database-class
// $handler->setDbConnection($db);

$handler->setDbConnection($db);
$handler->setDbTable('sessions');
session_set_save_handler($handler, true);
session_start();

Authors

Jamie Cressey, (*5)

License

MIT Public License, (*6)

The Versions

07/10 2015

dev-master

9999999-dev http://github.com/jamiecressey/php-mysql-session-handler

MySQL PHP Session Handler

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php mysql sessions

06/10 2015

0.0.1

0.0.1.0 http://github.com/jayc89/php-mysql-session-handler

MySQL PHP Session Handler

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php mysql sessions