Download the PHP package voku/session2db without Composer
On this page you can find all versions of the php package voku/session2db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download voku/session2db
More information about voku/session2db
Files in voku/session2db
Package session2db
Short Description A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.
License LGPL-3.0
Homepage http://stefangabos.ro/php-libraries/zebra-session/
Informations about the package session2db
:crown: Session2DB
A drop-in replacement for PHP's default session handler which stores session data in a database, providing both better performance and better security and protection against session fixation and session hijacking.
Session2DB implements session locking - a way to ensure that data is correctly handled in a scenario with multiple concurrent AJAX requests.
It is also a solution for applications that are scaled across multiple web servers (using a load balancer or a round-robin DNS) and where the user's session data needs to be available. Storing sessions in a database makes them available to all of the servers!
The library supports "flashdata" - session variable which will only be available for the next server request, and which will be automatically deleted afterwards. Typically used for informational or status messages (for example: "data has been successfully updated").
Session2DB is was inspired by John Herren's code from the Trick out your session handler article and Chris Shiflett's articles about PHP sessions and based on Zebra_Session.
The code is heavily commented and generates no warnings/errors/notices when PHP's error reporting level is set to E_ALL.
Requirements
PHP 7.x with the mysqli extension activated, MySQL 5.x+ (recommanded: mysqlnd extension)
How to install
How to use
After installing, you will need to initialise the database table from the install directory from this repo, it will containing a file named session_data.sql. This file contains the SQL code that will create a table that is used by the class to store session data. Import or execute the SQL code using your preferred MySQL manager (like phpMyAdmin or the fantastic Adminer) into a database of your choice.
*Note that this class assumes that there is an active connection to a MySQL database and it does not attempt to create one!
Support
For support and donations please visit Github | Issues | PayPal | Patreon.
For status updates and release announcements please visit Releases | Twitter | Patreon.
For professional support please contact me.
Thanks
- Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
- Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
- Thanks to Travis CI for being the most awesome, easiest continous integration tool out there!
- Thanks to StyleCI for the simple but powerfull code style check.
- Thanks to PHPStan && Psalm for relly great Static analysis tools and for discover bugs in the code!