snicco/session-wp-bridge

v2.0.0-beta.9 2024-09-07 14:27 UTC

README

codecov Psalm Type-Coverage Psalm level PhpMetrics - Static Analysis PHP-Versions

This package provides two WordPress specific session drivers for the snicco/session library:

Installation

composer require snicco/session-wp-bridge

Usage

WPDBSessionDriver

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();

WPObjectCacheDriver

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');

Contributing

This repository is a read-only split of the development repo of the Snicco project.

This is how you can contribute.

Reporting issues and sending pull requests

Please report issues in the Snicco monorepo.

Security

If you discover a security vulnerability, please follow our disclosure procedure.