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
aultPHP\VaultClient;
use VaultPHP\Authentication\Provider\Token;
use VaultPHP\SecretEngines\Engines\Transit\Transit;
use GuzzleHttp\Client;
// setting up independent http client - example with guzzle http client
$httpClient = new Client(['verify' => false]);
// setting up desired vault strategy
$authProvider = new Token('dummyToken');
// Initialize Vault client
$client = new VaultClient(
$httpClient,
$authProvider,
'https://vault.example.com:1337/transit/'
);
// List all keys from Transit Secret engine
$api = new Transit($client);
var_dump($api->listKeys());
$client = new VaultClient(
$yourPsr18Client,
$auth,
'https://vault.example.com:1337'
);
bash
composer