1. Go to this page and download the library: Download tomkyle/cookies 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/ */
tomkyle / cookies example snippets
use \tomkyle\Cookies\Cookie;
use \tomkyle\Cookies\SendCookie;
use \tomkyle\Cookies\UnsetCookie;
// Most simple
$c1 = new Cookie( "foo", "bar" );
// Optionally set expiration:
$c1->setExpiration( new \DateTime( "14day" ));
// Fire cookie:
new SendCookie( $c1 );
// Another example
$c2 = new Cookie( "any", "val", new \DateTime( "tomorrow" ) );
new SendCookie( $c2 );
// Delete from HTTP and $_COOKIE:
new UnsetCookie( $c2 );
use \tomkyle\Cookies\Cookie;
use \tomkyle\Cookies\RequestCookie;
use \tomkyle\Cookies\SendCookie;
// Fire cookie:
new SendCookie( new Cookie( "foo", "bar" ) );
// Retrieve cookie from next request:
$rc = new RequestCookie("foo");
echo $rc; // outputs "bar"
echo $rc->getValue(); // outputs "bar"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.