PHP code example of jsq / doctrine-cache-encrypter

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

    

jsq / doctrine-cache-encrypter example snippets


$cache = new \Doctrine\Common\Cache\RedisCache($redisClient);

$encryptedCache = new \Jsq\Cache\PasswordEncryption\Decorator(
    $cache,
    $password,
    $cipher // optional, defaults to 'aes-256-cbc'
);

$cache->save('normal_cache_data', 'Totally normal!');

$encryptedCache->save('api_keys', $keys);

$encryptedCache = new \Jsq\Cache\EnvelopeEncryption\Decorator(
    $cache,
    'file:///path/to/certificate.pem',
    'file:///path/to/private/key.pem',
    $passphrase_for_private_key_file, // optional, defaults to null
    $cipher // optional, defaults to 'aes-256-cbc'
);