davidlienhard / sessionhandler
🐘 php sessionhandler using database connection
Installs: 3 762
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:libary
Requires
- php: ^8.0
- davidlienhard/database: ^3
Requires (Dev)
README
🐘 php sessionhandler using a database connection
Setup
You can install through composer
with:
composer require davidlienhard/sessionhandler:^1
Note: davidlienhard/sessionhandler requires PHP 8.0
Example
<?php declare(strict_types=1); use DavidLienhard\SessionHandler\SessionHandler; $sessionHandler = new SessionHandler($db); // create session handler object session_set_save_handler($sessionHandler); // set custom session handler session_start(); // start session
Requirements
There must be an existing database connection using davidlienhard/database
. This database object must be passed to the constructor.
Database-Table
A table with the name sessions
with the following structure must exist in the database.
CREATE TABLE `sessions` ( `sessionID` varchar(100) NOT NULL PRIMARY KEY, `sessionLastSave` int DEFAULT NULL, `sessionData` text );
License
The MIT License (MIT). Please see LICENSE for more information.