WordPress session drivers for snicco/session
This package provides two WordPress specific session drivers for
the snicco/session
library:
WPDBSessionDriver
, uses thewpdb
class to storage sessions in a custom tableWPObjectCacheDriver
, uses the (persistent)WP_Object_Cache
to store sessions.
composer require snicco/session-wp-bridge
To use the WPDBSessionDriver
you first need an instance
of BetterWPDB
.
use Snicco\Bridge\SessionWP\WPDBSessionDriver;
use Snicco\Component\BetterWPDB\BetterWPDB;
$driver = new WPDBSessionDriver('my_app_session', BetterWPDB::fromWpdb());
// Creates the necessary db table if it does not exist already.
$driver->createTable();
use Snicco\Bridge\SessionWP\WPObjectCacheDriver;
$idle_timeout_in_seconds /* Same value as in your session config here */
$wp_object_cache_driver = new WPObjectCacheDriver('my_app_sessions');
This repository is a read-only split of the development repo of the Snicco project.
This is how you can contribute.
Please report issues in the Snicco monorepo.
If you discover a security vulnerability, please follow our disclosure procedure.