PHP code example of psecio / vaultlib
1. Go to this page and download the library: Download psecio/vaultlib 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/ */
psecio / vaultlib example snippets
essToken = "[... token from Vault account ...]";
$baseUrl = "https://your-vault-server:8200";
$client = new \Psecio\Vaultlib\Client($accessToken, $baseUrl);
// Check for seal
if ($client->isSealed() == true) {
echo 'The vault is sealed';
}
// Get a secret value
$secret = 'secretName';
$result = $client->getSecret($secret);
/// Delete a secret value
$client->deleteSecret($secret);
// Set a secret value
$client->setSecret($secret, ['testing1' => 'foo']);