tokenly/laravel-vault

Laravel 对 Hashicorp Vault 的接口

v0.2.3 2018-02-14 16:47 UTC

This package is not auto-updated.

Last update: 2024-09-15 04:00:17 UTC


README

Laravel 对 Hashicorp Vault 的接口。

这是一个围绕 https://github.com/jippi/vault-php-sdk 的包装。

安装

使用 composer 添加包

composer require tokenly/laravel-vault

与 Laravel 一起使用

添加服务提供者

将以下内容添加到您的应用程序配置中的 providers 数组中

Tokenly\Vault\VaultServiceProvider::class,

设置环境变量

VAULT_ADDR=https://127.0.0.1:8200
VAULT_CA_CERT_PATH=/path/to/ca.cert

使用它

// get the vault seal status
$vault = app('vault');
$seal_status = $vault->sys()->sealStatus();

// seal the vault
$token = '1389b58b-0000-4800-a000-1d8869aee825'; // your vault authentication token
$vault = app('vault')->setToken($token);
$vault->sys()->seal();