00f100 / fcphp-cookie
Package to manipulate Cookies
Installs: 200
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >=7.2
- 00f100/array_dot: 0.*
- 00f100/fcphp-crypto: 0.*
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-12-18 06:26:20 UTC
README
Package to manipulate Cookie
How to install
Composer:
$ composer require 00f100/fcphp-cookie
or add in composer.json
{ "require": { "00f100/fcphp-cookie": "*" } }
How to use
use FcPhp\Cookie\Facades\CookieFacade; /** * Facade to return instance of Cookie * * @param string $key Key into $_COOKIE of Cookie * @param array $cookies Variable $_SESSION * @param string $nonce Nonce to Crypto * @param string $pathKeys Path to save keys of Crypto * @param string $forceNewInstance Force create new instance * @return FcPhp\Cookie\Interfaces\ICookie */ CookieFacade::getInstance(string $key, array $cookies, string $nonce = null, string $pathKeys = null, bool $forceNewInstance = false) :ICookie // With No Crypto into content $cookie = CookieFacade::getInstance('key-cookie', $_COOKIE); // With Crypto into content use FcPhp\Crypto\Crypto; $nonce = Crypto::getNonce(); $cookie = CookieFacade::getInstance('key-cookie', $_COOKIE, $nonce); // Create new configuration $cookie->set('item.config', 'value'); // Print: value echo $cookie->get('item.config');