1. Go to this page and download the library: Download phpsoftbox/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/ */
phpsoftbox / cookie example snippets
use PhpSoftBox\Cookie\CookieJar;
use PhpSoftBox\Cookie\SetCookie;
$cookies = CookieJar::fromHeader('a=1; b=2');
$setCookie = SetCookie::create('sid', 'token')
->withHttpOnly(true)
->withSecure(true);
$headers = CookieJar::toHeaders([$setCookie]);
use PhpSoftBox\Cookie\CookieMiddleware;
use PhpSoftBox\Cookie\CookieQueue;
use PhpSoftBox\Cookie\SetCookie;
$queue = new CookieQueue();
$middleware = new CookieMiddleware($queue);
$queue->queue(SetCookie::create('token', 'abc'));
use PhpSoftBox\Cookie\CookieMiddleware;
use PhpSoftBox\Cookie\CookieQueue;
use PhpSoftBox\Encryptor\Encryptor;
$encryptor = new Encryptor(defaultKey: $_ENV['APP_KEY'] ?? null);
$middleware = new CookieMiddleware(
queue: new CookieQueue(),
encryptor: $encryptor,
except: ['XSRF-TOKEN', 'psb_session'],
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.