Module for working with PHP sessions

3.0.0 2018-04-07 17:26 UTC

This package is auto-updated.

Last update: 2022-04-28 23:18:52 UTC


Latest Stable Version Build Status Total Downloads License PHP 7 ready Code Climate Scrutinizer CQ


Module for working with PHP sessions.

composer require drmvc/session

How to use

More examples you can find here.

require_once __DIR__ . '/../vendor/autoload.php';

use DrMVC\Session;

// Create session object, you can also set prefix
// as first argument of Session class
$session = new Session();

// Init session object

// Get ID of current session
$session_id = $session->id();

// Set few keys in session
    ->set('text', 'value')
    ->set('integer', 123)
    ->set('boolean', true)
    ->set('array', ['mama', 'ama', 'criminal']);

// Receive variables of current session
$keys = $session->display();

// Get some single value by key
$value = $session->get('integer');

About PHP Unit Tests

First need to install all dev dependencies via composer update, then you can run tests by hands from source directory via ./vendor/bin/phpunit command.