PHP code example of hxgf / cookie

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

    

hxgf / cookie example snippets


use VPHP\cookie;

cookie::set('user_name', 'Buzz', [
  'expires' => time() + 86400, // unix time, default is 1 year
  'path' => '/custom-path/', // default is '/'
  'domain' => 'custom.example.com',
  'secure' => true,
  'httponly' => true,
  'samesite' => 'Lax',
]);

echo cookie::get('user_name');

cookie::delete('user_name');