Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

koshatul/vault

Repository files navigation

Hashicorp Vault Class for PHP

This is unmaintained, I haven't used it in quite a while and don't have the time to update and test it properly.

A interface for retrieving values from Hashicorp Vault in a PHP Project.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Installation

Use Composer to install the package:

Add the following to your composer.json and run composer update.

"require": {
    "koshatul/vault": "~1.0"
}

Usage

You can use this package to get configuration from a global or specific configuration store.

use Koshatul\Vault\Vault;
use Koshatul\Vault\VaultURI;
use Koshatul\Vault\VaultAuthToken;

$vaultURI = new VaultURI("http://127.0.0.1:8200/v1/");
$vaultAuthToken = new VaultAuthToken("tttttttt-wwww-xxxx-yyyy-zzzzzzzzzzzz");
$vault = new Vault($vaultURI, $vaultAuthToken);

$vault->write('secret/foo' ['pear' => 'table']);

$testValue = $vault->read('secret/foo');
echo "Pear: ".$testValue->get('pear');