PHP code example of fruit / cookiekit

1. Go to this page and download the library: Download fruit/cookiekit 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/ */

    

fruit / cookiekit example snippets


$cookies = new Fruit\CookieKit\Cookie;
$myval = $cookies['mykey'];
unset($cookies['mykey']);
// do something, and then
$cookies['anotherkey'] = $anotherval;
$cookies->send(); // send Set-Cookies header

$headers = [];
$setter = new PeclHttpCookieSetter($environment['Cookies'], function($str) use ($headers) {
	$headers['Set-Cookies'] = $str;
});
$cookies = new Cookie($setter);
$cookies['mykey'] = $myval;
$cookies->send();
return [200, $headers, 'hello, world'];