wplibs/session

This package is abandoned and no longer maintained. No replacement package was suggested.

The missing session handler in WordPress

1.0.3 2019-01-22 07:51 UTC

This package is auto-updated.

Last update: 2019-03-18 05:01:31 UTC


README

The missing Session manager for WordPress

Installation

composer require wplibs/session:^1.0

Usage

<?php

use WPLibs\Session\WP_Session;

$session = new WP_Session('my_plugin_session', [
    'lifetime'        => 1440,  // The session lifetime in minutes.
    'expire_on_close' => false, // If true, the session immediately expire on the browser closing.
    'cookie_name'     => null,
]);

// Must call before the `init` hook.
$session->hooks();

// In some where:
$session['user_address'] = 'Some where';

// Retrive
dump($session['user_address']);