PHPackages                             lucasberto/laravel-vault - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. lucasberto/laravel-vault

ActiveLibrary[File &amp; Storage](/categories/file-storage)

lucasberto/laravel-vault
========================

An easy Laravel integration for HashiCorp Vault

1.1.0(3mo ago)33.0k↓45.3%MITPHPPHP ^8.1|^8.2

Since Feb 12Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/lucasberto/laravel-vault)[ Packagist](https://packagist.org/packages/lucasberto/laravel-vault)[ RSS](/packages/lucasberto-laravel-vault/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (9)Used By (0)

Laravel Vault
=============

[](#laravel-vault)

A package for simple and easy Laravel and HashiCorp Vault integration.

Features
--------

[](#features)

- Simple integration with HashiCorp Vault
- Support for multiple Vault servers
- Clean facade-based API

### Supported Secret Engines (will add more in the future):

[](#supported-secret-engines-will-add-more-in-the-future)

- KV Secrets Engine v1
- KV Secrets Engine v2

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 9, 10, or 11
- HashiCorp Vault 1.12 or higher

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require lucasberto/laravel-vault
```

Configuration
-------------

[](#configuration)

After installing the package, you need to publish the configuration file:

```
php artisan vendor:publish --tag=vault-config
```

This will create a `config/vault.php` file in your project.

Also, you need to add the following lines to your `.env` file:

```
# Required configs
VAULT_ADDR=http://127.0.0.1:8200
VAULT_TOKEN=your-token-here

# Optional configs
VAULT_TIMEOUT=10   # Default: 30
VAULT_KV_ROOT=kv-v2 # Default: secret
```

If you want to use multiple Vault servers, you can add more addresses and tokens to the `.env` file:

```
VAULT_SECONDARY_ADDR=http://vault2.example.com:8200
VAULT_SECONDARY_TOKEN=another-token

# Optional configs
VAULT_SECONDARY_TIMEOUT=20   # Default: 30
VAULT_SECONDARY_KV_ROOT=kv-v2 # Default: secret
```

And update the `config/vault.php` file accordingly.

```
'servers' => [
        'main' => [
            'address' => env('VAULT_ADDR', 'http://127.0.0.1:8200'),
            'token' => env('VAULT_TOKEN'),
            'timeout' => env('VAULT_TIMEOUT', 30),
            'kv_root' => env('VAULT_KV_ROOT', 'secret'),
        ],
        'secondary' => [
            'address' => env('VAULT_SECONDARY_ADDR'),
            'token' => env('VAULT_SECONDARY_TOKEN'),
            'timeout' => env('VAULT_SECONDARY_TIMEOUT', 30),
            'kv_root' => env('VAULT_SECONDARY_KV_ROOT', 'secret'),
        ],
    ],
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Lucasberto\LaravelVault\Facades\Vault;

// List secrets (KV v2)
$secrets = Vault::listSecrets('path/to/secrets');
// List secrets (KV v1)
$secrets = Vault::listSecrets('path/to/secrets', 1);

// Get a secret (KV v2)
$secret = Vault::getSecret('path/to/secret');
// Using KV v1
$secret = Vault::getSecret('path/to/secret', 1);

// Store a secret (KV v2)
Vault::putSecret('path/to/secret', [
    'username' => 'admin',
    'password' => 'secret'
]);
// Store a secret (KV v1)
Vault::putSecret('path/to/secret', [
    'username' => 'admin',
    'password' => 'secret'
], 1);

// Delete a secret (KV v2)
Vault::deleteSecret('path/to/secret');
// Delete a secret (KV v1)
Vault::deleteSecret('path/to/secret', 1);

// Check if vault is unsealed
$isUnsealed = Vault::isUnsealed();

// Seal vault
$sealed = Vault::seal();

// Unseal vault (one call per key, after n calls, vault is unsealed)
Vault::unseal('key');

// Get vault health
$health = Vault::health();

// It is also possible to use a custom client (of type GuzzleHttp\Client)
$config = app()->config['vault']['servers']['main'];
$httpClient = new \GuzzleHttp\Client([
    'base_uri' => $config['address'],
    'headers' => [
        'X-Vault-Token' => $config['token'],
    ],
    'timeout' => $config['timeout'],
]);
$vaultClient = new Lucasberto\LaravelVault\VaultClient($config, $httpClient);
$vaultClient->getSecret('path/to/secret');
```

### Multiple servers

[](#multiple-servers)

```
// Use default connection
$secret = Vault::getSecret('path/to/secret');

// Use specific connection
$secret = Vault::connection('secondary')->getSecret('path/to/secret');
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance80

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Recently: every ~89 days

Total

8

Last Release

104d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed9546fca7c999f5db21d298960151b2f8b6d58c40a1669d59d2036856d086b0?d=identicon)[lucasberto](/maintainers/lucasberto)

---

Top Contributors

[![lucasberto](https://avatars.githubusercontent.com/u/1489069?v=4)](https://github.com/lucasberto "lucasberto (18 commits)")

---

Tags

laravelsecurityencryptionstoragevaultKey valuesecretscredentialshashicorp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lucasberto-laravel-vault/health.svg)

```
[![Health](https://phpackages.com/badges/lucasberto-laravel-vault/health.svg)](https://phpackages.com/packages/lucasberto-laravel-vault)
```

###  Alternatives

[unisharp/laravel-settings

Persistent settings manager for laravel, translations are supported.

107169.9k2](/packages/unisharp-laravel-settings)[dcblogdev/laravel-dropbox

A Laravel Dropbox v2 package

3263.0k](/packages/dcblogdev-laravel-dropbox)[luoyy/ali-oss-storage

aliyun oss filesystem storage for laravel 9+

1529.9k1](/packages/luoyy-ali-oss-storage)[zing/laravel-flysystem-obs

Flysystem Adapter for OBS

1211.2k](/packages/zing-laravel-flysystem-obs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
