00f100/fcphp-session

该软件包最新版本(0.1.3)没有可用的许可证信息。

用于操作会话的软件包

安装: 143

依赖项: 1

建议者: 0

安全: 0

星标: 1

关注者: 1

分支: 1

开放问题: 0

类型:软件包

0.1.3 2018-08-04 15:59 UTC

This package is auto-updated.

Last update: 2024-09-18 05:39:15 UTC


README

用于操作会话的软件包

Build Status codecov Total Downloads

如何安装

Composer

$ composer require 00f100/fcphp-session

或在 composer.json 中添加

{
    "require": {
        "00f100/fcphp-session": "*"
    }
}

如何使用

use FcPhp\Session\Facades\SessionFacade;

/**
 * Method to return instance of Session 
 *
 * @param array $cookies Cookies default
 * @param string $nonce Nonce to use 00f100/fcphp-crypto
 * @param string $pathKeys Path to save crypto-keys
 * @return void
 */
SessionFacade::getInstance(array $cookies, string $nonce = null, string $pathKeys = null);


// Start session and load cache

$nonce = '...';
$pathKeys = 'var/crypto/keys';

// Use Cache into file
$sessionFile = SessionFacade::getInstance($_COOKIE, $nonce, $pathKeys);

// Create new configuration
$sessionRedis->set('item.config', 'value');

// Print: value
echo $sessionRedis->get('item.config');

/*
Return: 
Array (
    'item' => Array(
        'config' => 'value'
    )
)
*/
print_r($sessionRedis->get());

// Save into Cookie
$sessionRedis->commit();