1. Go to this page and download the library: Download bag2/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/ */
bag2 / cookie example snippets
use Bag2\Cookie\CookieOvenBuilder;
$now = \time();
// [Recomended] Create an Oven instance by CookieOvenBuilder
$cookie = (new CookieOvenBuilder)->withSameSite('Strict')->build();
$cookie->add('NameA', 'value 1', ['expires' => $now + 1200]);
$cookie->add('NameB', 'value 2', ['expires' => $now + 3600]);
// [Obsolete] Create an Oven instance by function
$cookie = Bag2\Cookie\oven(['secure' => true, 'httponly' => true, 'samesite' => 'Strict']);