PHP code example of koshatul / vault

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

    

koshatul / vault example snippets


use Koshatul\Vault\Vault;
use Koshatul\Vault\VaultURI;
use Koshatul\Vault\VaultAuthToken;

$vaultURI = new VaultURI("http://127.0.0.1:8200/v1/");
$vaultAuthToken = new VaultAuthToken("tttttttt-wwww-xxxx-yyyy-zzzzzzzzzzzz");
$vault = new Vault($vaultURI, $vaultAuthToken);

$vault->write('secret/foo' ['pear' => 'table']);

$testValue = $vault->read('secret/foo');
echo "Pear: ".$testValue->get('pear');