https://github.com/00f100/fcphp-session
Package to manipulate Session
https://github.com/00f100/fcphp-session
fcphp fcphp-session php7 php72 session
Last synced: 4 months ago
JSON representation
Package to manipulate Session
- Host: GitHub
- URL: https://github.com/00f100/fcphp-session
- Owner: 00F100
- License: mit
- Created: 2018-06-30T21:17:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-04T15:59:49.000Z (almost 8 years ago)
- Last Synced: 2025-03-13T04:29:45.388Z (over 1 year ago)
- Topics: fcphp, fcphp-session, php7, php72, session
- Language: PHP
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FcPhp Session
Package to manipulate Session
[](https://travis-ci.org/00F100/fcphp-session) [](https://codecov.io/gh/00F100/fcphp-session) [](https://packagist.org/packages/00F100/fcphp-session)
## How to install
Composer:
```sh
$ composer require 00f100/fcphp-session
```
or add in composer.json
```json
{
"require": {
"00f100/fcphp-session": "*"
}
}
```
## How to use
```php
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();
```