PHP code example of kecik / cookie

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

    

kecik / cookie example snippets



 = new Kecik\Kecik();
$cookie = new Kecik\Cookie($app);


 = new Kecik\Kecik();

//Config for encrypt cookie
$app->config->set('cookie.encrypt', TRUE);
$cookie = new Kecik\Cookie($app);

set(string $name, mixed $value)


 = new Kecik\Kecik();
$cookie = new Kecik\Cookie($app);
$cookie->set('integer', 123);
$cookie->set('string', 'satu dua tiga');
$cookie->set('array', array('satu', 'dua', 'tiga'));

get(string $name)


 = new Kecik\Kecik();
$cookie = new Kecik\Cookie($app);
$cookie->set('integer', 123);
$cookie->set('string', 'satu dua tiga');
$cookie->set('array', array('satu', 'dua', 'tiga'));

echo 'cookie Integer: '.$cookie->get('integer').'<br />';
echo 'cookie String: '.$cookie->get('string').'<br />';
echo 'cookie Array: ';
print_r($cookie->get('array'));

delete(string $name)


 = new Kecik\Kecik();
$cookie = new Kecik\Cookie($app);
$cookie->set('kecik_cookie', 'ini nilai cookie nya');

echo 'kecik_cookie: '.$cookie->get('kecik_cookie').'<br />';

$cookie->delete('kecik_cookie');
echo 'kecik_cookie: '.$cookie->get('kecik_cookie').'<br />';


 = new Kecik\Kecik();
$cookie = new Kecik\Cookie($app);

$cookie->clear();