PHPackages                             audunru/config-secrets - 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. audunru/config-secrets

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

audunru/config-secrets
======================

Retrieve secrets from 3rd party services and use them as config variables in Laravel

v7.0.0(1mo ago)12.9k↑16.7%MITPHPPHP ^8.3CI passing

Since Oct 11Pushed 1mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (22)Versions (28)Used By (0)

Configuration secrets for Laravel
=================================

[](#configuration-secrets-for-laravel)

[![Build Status](https://github.com/audunru/config-secrets/actions/workflows/validate.yml/badge.svg)](https://github.com/audunru/config-secrets/actions/workflows/validate.yml)[![Coverage Status](https://camo.githubusercontent.com/e897de4c498e3717fe5cc0b4928347e945c9eabd4ab45a010f6a4703f428b25d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f617564756e72752f636f6e6669672d736563726574732f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/audunru/config-secrets?branch=main)

Retrieve secrets from AWS Secrets Manager and override config variables in Laravel.

As an example, you could store your database password in AWS Secrets Manager instead of your .env file. This package does not modify your .env file or config files. Instead, the configuration values are set using Laravel's `config()` helper right after your application has started.

Migration guides
================

[](#migration-guides)

- [v1 to v2](docs/v1-v2-migration.md)

Installation
============

[](#installation)

Step 1: Install with Composer
-----------------------------

[](#step-1-install-with-composer)

```
composer require audunru/config-secrets
```

Step 2: Publish configuration
-----------------------------

[](#step-2-publish-configuration)

Publish the configuration file by running:

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

Step 3: Edit configuration
--------------------------

[](#step-3-edit-configuration)

This package supports two config providers: `aws` retrieves secrets from AWS Secrets Manager, and the `array` provider simply retrieves them from [config-secrets.php](config/config-secrets.php).

### Aws

[](#aws)

In [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/):

1. Create a new secret.
2. Set the secret value to any number of key/value pairs. You can prefix the secret value with `base64:` followed by a base64 encoded string. This is useful for private and public keys, for instance.

In your Laravel application:

1. Set `AWS_DEFAULT_REGION` in `.env` or set the region directly in [config-secrets.php](config/config-secrets.php)
2. Set `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` in `.env` or [use any of the other options that AWS SDK offers](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html)
3. Map Laravel configuration keys to secret keys under the `aws` provider's `configuration` section in [config-secrets.php](config/config-secrets.php)

Array
-----

[](#array)

The array provider replaces configuration values with values from [config-secrets.php](config/config-secrets.php). Look in [config-secrets.php](config/config-secrets.php) for an example. This allows you to keep environment specific configuration values in source control. For obvious reasons, do not use the array provider for values that should be kept secret.

Step 4: Update bootstrap/app.php
--------------------------------

[](#step-4-update-bootstrapappphp)

Add the following lines to `bootstrap/app.php` (recommended but not required):

```
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Bootstrap\LoadConfiguration;
use audunru\ConfigSecrets\ConfigSecretsServiceProvider;

$app->afterBootstrapping(LoadConfiguration::class, fn (Application $app) => ConfigSecretsServiceProvider::registerAndUpdate($app));
```

Loading the secrets in `bootstrap/app.php` instead of in a service provider ensures that you can override (probably) any configuration value. For instance, Laravel's `RedisServiceProvider` uses the available configuration values when it is registered. Without the code above, you won't be able to override the Redis password.

Step 5: Enable configuration cache
----------------------------------

[](#step-5-enable-configuration-cache)

It is *very important* that you cache your Laravel configuration with `php artisan config:cache` or `php artisan optimize` when you use this package. If not, secrets will be retrieved for every request. This process is slow and costly!

Alternatives
============

[](#alternatives)

[AWS Secrets Manager](https://github.com/TappNetwork/laravel-aws-secrets-manager)

Development
===========

[](#development)

Testing
-------

[](#testing)

Run tests:

```
composer verify
```

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance90

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 55.5% 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 ~81 days

Recently: every ~32 days

Total

21

Last Release

56d ago

Major Versions

v2.0.0 → v3.0.02024-04-07

v3.0.1 → v4.0.02024-05-08

v4.1.3 → v5.0.02025-03-16

v5.0.2 → v6.0.02026-03-01

v6.0.0 → v13.x-dev2026-03-24

PHP version history (4 changes)v0.1.0PHP ^8.0

v1.0.0PHP ^8.1

v2.0.0PHP ^8.2

v13.x-devPHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/444043228e007e4f695d18a30380b811fb60077138f7c46f111f45a1b98e2f1c?d=identicon)[audunru](/maintainers/audunru)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (66 commits)")[![audunru](https://avatars.githubusercontent.com/u/5163790?v=4)](https://github.com/audunru "audunru (38 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (4 commits)")

---

Tags

laravelawsconfigsecrets

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/audunru-config-secrets/health.svg)

```
[![Health](https://phpackages.com/badges/audunru-config-secrets/health.svg)](https://phpackages.com/packages/audunru-config-secrets)
```

###  Alternatives

[akaunting/laravel-setting

Persistent settings package for Laravel

495805.1k7](/packages/akaunting-laravel-setting)[dumpk/elastcoder

AWS Elastic Transcoder Service Integration

2819.7k](/packages/dumpk-elastcoder)

PHPackages © 2026

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