PHP code example of beta / bx.hashicorp

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

    

beta / bx.hashicorp example snippets


use Bx\HashiCorp\Factory;

$vaultOptionHolder = Factory::crateCached('main');  // init option holder from module setting
$vaultOptionHolder->getOptionValue('PRIVATE_KEY', 'my.module'); // read value by key PRIVATE_KEY
$vaultOptionHolder->setOptionValue('PRIVATE_KEY', '...', 'my.module'); // update value by key PRIVATE_KEY