fliglio / vault
Installs: 18 778
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 8
Forks: 1
Open Issues: 0
Requires
- php: >=5.6
- guzzlehttp/guzzle: ~5.0 || ~6.0
Requires (Dev)
- phpunit/phpunit: 5.7.*
This package is auto-updated.
Last update: 2024-12-29 05:10:29 UTC
README
Vault SDK
Supports:
- auth
- tokens
- authrole
- general
- read
- write
Examples
Configure Environment
The default client will leverage the environment variables VAULT_ADDR
and VAULT_TOKEN
export VAULT_ADDR=http://localhost:8200
export VAULT_TOKEN=horde
Read and Write Secrets
$secrets = [
"foo" => "bar",
"baz" => "boo",
];
$c = new VaultClient();
$resp = $c->write('secret/testing', $secrets);
$found = $c->read('secret/testing');
print_r($found['data']);
// Output:
// Array
// (
// [baz] => boo
// [foo] => bar
// )
Login with AppRole
$roleId = "...";
$secretId = "...";
$secrets = [
"foo" => "bar",
"baz" => "boo",
];
$c = new VaultClient(new DefaultVaultConfigFactory([
'auth' => new AppRole($roleId, $secretId),
]));
$resp = $c->write('secret/testing', $secrets);
$found = $c->read('secret/testing');
print_r($found['data']);
// Output:
// Array
// (
// [baz] => boo
// [foo] => bar
// )