PHP code example of mittwald / vault-php
1. Go to this page and download the library: Download mittwald/vault-php 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/ */
mittwald / vault-php example snippets
// setting up independent http client
$httpClient = new Client();
// setting up vault auth provider
$auth = new Token('foo');
// creating the vault request client
$client = new VaultClient(
$httpClient,
$auth,
'http://127.0.0.1:8200'
);
// selecting the desired secret engine
// e.g. Transit Secret Engine
$api = new Transit($client);
// calling specific endpoint
$response = $api->listKeys();
//reading results
var_dump($response->getKeys());
//...
//...
//Profit...
public function __construct(
HttpClient $httpClient,
AuthenticationProviderInterface $authProvider,
string $apiHost
)