PHP code example of leafs / cookie

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

    

leafs / cookie example snippets


response()
  ->withCookie('name', 'Fullname')
  ->withCookie('age', 20)
  ->json([
      'message' => 'Cookies set'
    ]);

cookie()->set('name', 'Fullname', [
  'expire' => time() + 3600,
  'path' => '/',
  'domain' => 'example.com',
  'secure' => true,
  'httponly' => true,
  'samesite' => 'None'
]);