psecio/vaultlib

A PHP library for interacting with a Vault secrets store

0.1 2018-07-17 16:19 UTC

This package is auto-updated.

Last update: 2024-12-15 11:25:09 UTC


README

A simple Vault client for PHP making use of Guzzle for HTTP API requests.

Installation

Install via Composer:

composer require psecio/vaultlib

Usage:

<?php
require_once __DIR__.'/vendor/autoload.php';

$accessToken = "[... token from Vault account ...]";
$baseUrl = "https://your-vault-server:8200";

$client = new \Psecio\Vaultlib\Client($accessToken, $baseUrl);

// Check for seal
if ($client->isSealed() == true) {
    echo 'The vault is sealed';
}

// Get a secret value
$secret = 'secretName';
$result = $client->getSecret($secret);

/// Delete a secret value
$client->deleteSecret($secret);

// Set a secret value
$client->setSecret($secret, ['testing1' => 'foo']);
?>