Download the PHP package itk-dev/vault-bundle without Composer
On this page you can find all versions of the php package itk-dev/vault-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download itk-dev/vault-bundle
More information about itk-dev/vault-bundle
Files in itk-dev/vault-bundle
Package vault-bundle
Short Description Symfony bundle for HashiCorp Vault
License MIT
Informations about the package vault-bundle
Vault Bundle
This bundle enables Symfony sites to interact with HashiCorp Vault using the "approle" authentication method. It allows fetching secrets and provides the capability for local caching of both access tokens and the secrets themselves.
The bundle offers a services wrapper for the PHP
library itk-dev/vault-library.
Additionally, it includes an environment variable processor, enabling the
retrieval of secrets directly in .env
files at runtime.
Install
Setup
Create a configuration file at config/packages/itkdev_vault.yaml
and add the
three referenced variables to .env
with placeholder values. Then add the
actual values to .env.local
.
Usage
Use the service by simply injecting the service named Vault
from the
namespace ItkDev\VaultBundle\Service
. Use the login function to fetch a token
and then use the acquired token in the getSecret
or getSecrets
functions.
To use the environment variable processor, use the following format to specify what to retrieve from the vault:
- Path: The secret engine path (e.g. prod, stg, test)
- Secret: Name of the secret in the engine (eg. itksites, dokk1)
- Key: The secret key that should be fetched (eg. OIDC, pretix-api-key)
- Version: Optional, fetch a specific version of the secret.
- Expire: Optional, the number of seconds to cache the secret.
When the variable have been defined, the next step is to activate the processor
on the variable in config/services.yaml
using the vault
keyword.
CLI support
This bundle also comes with two CLI commands to help debug configuration and to
check that you fetch the expected data from the vault. Use the --help
option
to symfony console to see the options available for the commands.
itkdev:vault:login
itkdev:vault:secret
Developing
See details on contributing in the contributing docs.
All versions of vault-bundle with dependencies
symfony/http-client Version ^6.4|^7.0
nyholm/psr7 Version ^1.8
itk-dev/vault Version ^0.1.0
symfony/dependency-injection Version ^6.4|^7.0
symfony/config Version ^6.4|^7.0
symfony/http-kernel Version ^6.4|^7.0