Cookie
Installation
composer require sonsofphp/cookieUsage
<?php
use SonsOfPHP\Component\Cookie\Cookie;
$cookie = new Cookie('name', 'value');
header('Set-Cookie: ' . $cookie->getHeaderValue());
// OR
// header('Set-Cookie: ' . (string) $cookie);
// Set various attributes
$cookie = $cookie
->withPath('/')
->withDomain('docs.sonsofphp.com')
;Last updated