PHP code example of ellipse / cookie-encryption

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

    

ellipse / cookie-encryption example snippets




namespace App;

use Defuse\Crypto\Key;
use Ellipse\Cookies\EncryptCookiesMiddleware;

// Load an encryption key from your config.
$key = Key::loadFromAsciiSafeString(getenv('APP_KEY'));

// By using this middleware all cookies will be decrypted/encrypted, except the one named 'bypassed'.
$middleware = new EncryptCookiesMiddleware($key, ['bypassed']);