1. Go to this page and download the library: Download keboola/vault-api-client 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/ */
keboola / vault-api-client example snippets
use Keboola\VaultApiClient\Variables\Model\ListOptions;
use Keboola\VaultApiClient\Variables\Model\Variable;
use Keboola\VaultApiClient\Variables\VariablesApiClient;
$client = new VariablesApiClient(
baseUrl: 'https://vault.keboola.com',
token: 'your-storage-api-token',
);
// Create a variable
$variable = $client->createVariable(
key: 'MY_SECRET',
value: 'secret-value',
flags: [Variable::FLAG_ENCRYPTED],
attributes: ['branchId' => '123'],
);
// List variables
$variables = $client->listVariables(new ListOptions(offset: 0, limit: 50));
// List scoped variables for a branch
$branchVariables = $client->listScopedVariablesForBranch(branchId: '123');
// Delete a variable
$client->deleteVariable(hash: $variable->hash);
use Monolog\Logger;
$client = new VariablesApiClient(
baseUrl: 'https://vault.keboola.com',
token: 'your-storage-api-token',
backoffMaxTries: 3,
logger: new Logger('vault'),
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.