Skip to content

Latest commit

History

122 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

davidlienhard/sessionhandler

🐘 php sessionhandler using a database connection

Latest Stable VersionSource CodeSoftware LicenseMinimum PHP VersionCI Status

Setup

You can install through composer with:

composer require davidlienhard/sessionhandler:^1

Note: davidlienhard/sessionhandler requires PHP 8.0

Example

<?phpdeclare(strict_types=1);
useDavidLienhard\SessionHandler\SessionHandler;
$sessionHandler = newSessionHandler($db); // create session handler objectsession_set_save_handler($sessionHandler); // set custom session handlersession_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.

CREATETABLE `sessions` (
`sessionID`varchar(100) NOT NULLPRIMARY KEY,
`sessionLastSave`int DEFAULT NULL,
`sessionData`text
);

License

The MIT License (MIT). Please see LICENSE for more information.

About

🐘 php sessionhandler using database connection

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages