dykyi-roman / vault-client
Vault Client
Requires
- php: >=5.6
- eloquent/enumeration: ^5.1
- guzzlehttp/guzzle: ^6.3
- psr/http-message: *
- psr/log: ^1.0
- tedivm/stash: ^0.14.2
Requires (Dev)
This package is not auto-updated.
Last update: 2024-11-16 15:45:39 UTC
README
How to run vault server on the Docker read here. Author: neb0t
Vault Client
Vault is a tool for securely accessing secrets. A secret is anything that you want to tightly control access to, such as API keys, passwords, certificates, and more. Vault provides a unified interface to any secret, while providing tight access control and recording a detailed audit log.
Documentation
All documentation is available on the Vault website.
Cache system
Stash - a package was used for cache data. Stash makes it easy to speed up your code by caching the results of expensive functions or code.
Installation
Composer
The preferred way to install this extension is through Composer.
Either run
composer require dykyi-roman/vault-client
or add
"dykyi-roman/vault-client": "^1.2"
to the require section of your composer.json
Usage
- Make sure to update your /.env file with your app ID & secret.
VAULT_ROOT_TOKEN_ID=5HNcw7sdf1CcafOFflUes6VOdjPaIJJEDs
VAULT_HOST=http://your-website.com/
- Or use function
setOptions()
Example
require_once '../vendor/autoload.php';
use Dykyi\VaultClient;
use Dykyi\ResponseDataExtractor;
use GuzzleHttp\Client;
$dotenv = new \Dotenv\Dotenv(__DIR__);
$dotenv->load();
$client = new VaultClient(new Client(), new ResponseDataExtractor());
if ($client->init()) {
$client->write('db', ['user' => 'password']);
$client->read('db');
$client->update('db', ['user' => 'new_password']);
$client->read('db');
$client->delete('db');
}
Available environment
- DEV -
/v1/secret/dev/
- PROD -
/v1/secret/prod/
- TEST -
/v1/secret/test/
Author
Dykyi Roman, e-mail: mr.dukuy@gmail.com