PHPackages                             fkrfld/azure-key-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fkrfld/azure-key-vault

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fkrfld/azure-key-vault
======================

Allow secrets to be easily fetched from an Azure Key Vault from within a Laravel application

v1.0.0(10mo ago)05proprietaryPHPPHP ^8.1

Since Jan 25Pushed 10mo agoCompare

[ Source](https://github.com/fikrifalindi/azure-key-vault)[ Packagist](https://packagist.org/packages/fkrfld/azure-key-vault)[ RSS](/packages/fkrfld-azure-key-vault/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (11)Used By (0)

Azure Key Vault wrapper for Laravel
===================================

[](#azure-key-vault-wrapper-for-laravel)

Overview
--------

[](#overview)

This package allows secrets to be fetched from, or set in, an [Azure Key Vault](https://docs.microsoft.com/en-us/azure/key-vault/), with an interface similar to `env()` and `config()`.

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

[](#installation)

Require this package with composer:

```
composer require insites-consulting/azure-key-vault

```

The package should be discovered by Laravel on installation.

The following environment variables must be set, if the package's default configuration is used:

- `AZURE_AD_CLIENT_ID` the UUID of the service principal which will be used to access the vault. This service principal needs "Get Secret" permission on that vault.
- `AZURE_AD_CLIENT_SECRET` the shared secret for that service principal.
- `AZURE_AD_TENANT_ID` the UUID for the tenant under which that service principal exists.
- `AZURE_KEY_VAULT_NAME` the name of the key vault (used as a subdomain in its hostname; e.g. `fred` in `fred.vault.azure.net`).

This package publishes its configuration to `vault.php`. This can be done with:

```
php artisan vendor:publish --provider='Fkrfld\AzureKeyVault\ServiceProvider'

```

The configuration entries are as follows:

- `tenant_id` the tenant UUID
- `client_id` the service principal UUID
- `client_secret` the service principal shared secret
- `vault` the vault name

Usage
-----

[](#usage)

This package provides a facade called `Vault`, with three methods `Vault::secret()`, `Vault::setSecret()` and `Vault::setVault()`, as well as a global helper function `secret()`.

To fetch a secret called 'apikey':

```
$secret = Vault::secret('apikey');
```

If the secret does not exist, `null` will be returned, unless a different default value is specified, as here:

```
$other_secret = Vault::secret('otherkey', 'default-value');
```

If there is an error, an `Fkrfld\AzureKeyVault\AzureKeyVaultException` will be thrown. Its message will be set to the body of the error response from Azure, and its code will be set to the HTTP status of that response.

The global helper function behaves identically to the facade method:

```
$secret = secret('apikey');
$other_secret = secret('otherkey', 'default-key');
```

To set a secret called 'apikey' to the value 'longsecretvalue':

```
Vault::setSecret('apikey', 'longsecretvalue');
```

This method is void, but will throw an `Fkrfld\AzureKeyVault\AzureKeyVaultException` on error, in the same manner as `Vault::secret()`.

In order to work with multiple vaults, use `Vault::setVault()` to change the vault name used:

```
$secret = secret('apikey');
Vault::setVault('other-vault');
$other_secret = secret('apikey');
```

This is persistent: the newly set vault will remain until `Vault::setVault()`is called again.

Calling `Vault::setVault()` with no argument will reset the vault name to that set in the config file:

```
$other_secret = secret('apikey');
Vault::setVault();
$secret = secret('apikey');
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance53

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 74.1% 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 ~201 days

Recently: every ~269 days

Total

9

Last Release

323d ago

Major Versions

v0.3.3 → v1.0.02025-06-20

PHP version history (3 changes)v0.1PHP ^7.4

v0.2PHP ^7.4|^8.0|^8.1

v1.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![stephen-isc](https://avatars.githubusercontent.com/u/74552516?v=4)](https://github.com/stephen-isc "stephen-isc (20 commits)")[![mrdth](https://avatars.githubusercontent.com/u/781215?v=4)](https://github.com/mrdth "mrdth (2 commits)")[![danny-isc](https://avatars.githubusercontent.com/u/74405882?v=4)](https://github.com/danny-isc "danny-isc (1 commits)")[![adrum](https://avatars.githubusercontent.com/u/1464185?v=4)](https://github.com/adrum "adrum (1 commits)")[![shealavington](https://avatars.githubusercontent.com/u/16869302?v=4)](https://github.com/shealavington "shealavington (1 commits)")[![fikrifalindi](https://avatars.githubusercontent.com/u/17400997?v=4)](https://github.com/fikrifalindi "fikrifalindi (1 commits)")[![bobbypiperagrovista](https://avatars.githubusercontent.com/u/122941123?v=4)](https://github.com/bobbypiperagrovista "bobbypiperagrovista (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/fkrfld-azure-key-vault/health.svg)

```
[![Health](https://phpackages.com/badges/fkrfld-azure-key-vault/health.svg)](https://phpackages.com/packages/fkrfld-azure-key-vault)
```

###  Alternatives

[laravolt/avatar

Turn name, email, and any other string into initial-based avatar or gravatar.

2.0k5.4M31](/packages/laravolt-avatar)[anlutro/l4-settings

Persistent settings in Laravel.

9312.4M19](/packages/anlutro-l4-settings)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[beyondcode/laravel-favicon

Create dynamic favicons based on your environment settings.

37345.5k](/packages/beyondcode-laravel-favicon)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)

PHPackages © 2026

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