PHP code example of jc-it / secrets

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

    

jc-it / secrets example snippets


$secrets = new \JCIT\secrets\Secrets(
    new \JCIT\secrets\storages\Chained(
        new \JCIT\secrets\storages\Cache(getenv()),
        new \JCIT\secrets\storages\Json('/run/env.json'),
        new \JCIT\secrets\storages\Filesystem(__DIR__ . '/secrets'),
    )
);

$secrets->get('<secret>', '<optional default value>');

$secrets->getAndThrowOnNull('<secret>');