PHPackages                             atldays/laravel-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. [Security](/categories/security)
4. /
5. atldays/laravel-secrets

ActiveLibrary[Security](/categories/security)

atldays/laravel-secrets
=======================

Load secrets from external providers and apply them to Laravel from a cached payload.

v1.0.0(1mo ago)00MITPHPPHP ^8.1CI passing

Since Apr 23Pushed 1mo agoCompare

[ Source](https://github.com/atldays/laravel-secrets)[ Packagist](https://packagist.org/packages/atldays/laravel-secrets)[ Docs](https://github.com/atldays/laravel-secrets)[ RSS](/packages/atldays-laravel-secrets/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (9)Versions (3)Used By (0)

Laravel Secrets
===============

[](#laravel-secrets)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b591cf618ed60ba9b00c246380d59ada2b7c26aaa4ab6d88e43a443c8c800d4d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61746c646179732f6c61726176656c2d736563726574732e7376673f6c6f676f3d7061636b6167697374267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/atldays/laravel-secrets)[![Total Downloads](https://camo.githubusercontent.com/970b4b81b174d8eda345779e8cee21c83bf81e0ea1f36c9f40745c4892d19be1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61746c646179732f6c61726176656c2d736563726574732e7376673f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://packagist.org/packages/atldays/laravel-secrets/stats)[![CI](https://camo.githubusercontent.com/c0a585571e872672145b8bff5ccf41edbb14faa8b7d2934223b5f270cc4a3d25/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61746c646179732f6c61726176656c2d736563726574732f63692e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d4349)](https://github.com/atldays/laravel-secrets/actions/workflows/ci.yml)[![License: MIT](https://camo.githubusercontent.com/7a1226d14a365d288bfe51ece915ee0c7e754a16faa51ff06436504de29b33b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e7376673f7374796c653d666f722d7468652d6261646765)](LICENSE.md)

`atldays/laravel-secrets` lets Laravel applications load sensitive configuration from external secret providers without turning every request into a network call.

It gives you the same developer experience as regular environment variables, but the values come from a provider, are cached inside Laravel, and are applied during boot only from that cached payload.

That means:

- no provider API calls during normal requests
- no custom runtime lookup layer in your application code
- no need to replace your config with package-specific accessors
- one explicit refresh step when secrets change

This package is designed for teams that want a safer and more operationally friendly alternative to keeping production secrets directly in `.env` files.

Why Use It
----------

[](#why-use-it)

Most Laravel applications still depend on environment variables for things like:

- `APP_KEY`
- database credentials
- queue and mail credentials
- API tokens
- service-to-service authentication

That works well in local development, but in production it often means:

- secrets are copied into files on disk
- rotation becomes manual and error-prone
- infrastructure and application config drift apart
- secret storage is handled outside a dedicated secret manager

Laravel Secrets keeps the familiar Laravel config flow, but moves secret storage to a provider and uses Laravel cache as the runtime handoff.

How It Works
------------

[](#how-it-works)

The package uses a simple two-step flow:

1. `php artisan secrets:cache` fetches secrets from every configured driver, or from one driver when you pass `--driver`.
2. The resulting payload is stored in the configured Laravel cache store.
3. During application boot, the package reads only that cached payload.
4. The package writes the resolved values into Laravel's env repository and into the config paths defined in `config_variables`.

No provider calls are made while handling a normal HTTP request, queue job, or console command unless you explicitly ask for fresh values.

Supported Drivers
-----------------

[](#supported-drivers)

Currently supported drivers:

- `AWS Secrets Manager`

More drivers are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the driver contribution workflow.

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

[](#installation)

```
composer require atldays/laravel-secrets
```

Compatibility
-------------

[](#compatibility)

Current support matrix:

- PHP `8.1+`
- Laravel `10`, `11`, `12`, and `13`
- AWS Secrets Manager as the first built-in driver

The package is tested in CI across the supported Laravel versions, and the AWS driver also includes live integration coverage.

Publish the config when you want to customize the package:

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

Quick Start
-----------

[](#quick-start)

Minimal setup:

```
