PHP code example of codezero / cookie

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

    

codezero / cookie example snippets


composer 



$cookie = new \CodeZero\Cookie\VanillaCookie();

$key = 'my secret app key';
$encrypter = new \CodeZero\Encrypter\DefaultEncrypter($key);
$cookie = new \CodeZero\Cookie\VanillaCookie($encrypter);

$cookie = \App::make('CodeZero\Cookie\Cookie');

$cookieValue = $cookie->get('cookieName');

$minutesValid = 120;
$cookie->store('cookieName', 'cookieValue', $minutesValid);

$cookie->forever('cookieName', 'cookieValue');

$cookie->delete('cookieName');

if ($cookie->exists('cookieName')) {
    // The cookie exists!
}

$ composer run test