PHP code example of temant / cookie-manager

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

    

temant / cookie-manager example snippets


use Temant\CookieManager\CookieManager;

// Set a cookie with a 1-hour expiration
CookieManager::set('cookie_name', 'abc123', time() + 3600);

// Get the value of a cookie
$userSession = CookieManager::get('cookie_name');

// Check if a cookie exists
$isLoggedIn = CookieManager::has('cookie_name');

// Delete a cookie
CookieManager::delete('cookie_name');
bash
phpunit --bootstrap vendor/autoload.php tests