1. Go to this page and download the library: Download coercive/cookie library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
coercive / cookie example snippets
use Coercive\Security\Cookie\Cookie;
# No need to reload the document.
# The Cookie class creates and deletes cookies also in the super global $_COOKIE.
# Instantiate and set your options
$cookie = new Cookie;
$cookie->setPath('/');
$cookie->setDomain('.domain.extension');
// etc...
# Option : anonymise -> cookie names are now sha1 + salt
$cookie->anonymize(true, 'abcd1234');
# You can prefix anonymised cookie : Hello_*************
$cookie->anonymize(true, 'abcd1234', 'Hello_');
# Plain cookie
$cookie->set('MyCookie', 'Hey ! This is an example cookie !', time() + 600);
$var = $cookie->get('MyCookie');
# Crypted cookie
$cookie = new Cookie('My Password');
$cookie->setSafe('MyCookie', 'Hey ! This is an example cookie !', time() + 600);
$var = $cookie->getSafe('MyCookie');
# Delete cookie
$cookie->delete('MyCookie');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.