PHPackages                             genyaa/laravel-safe-config - 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. genyaa/laravel-safe-config

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

genyaa/laravel-safe-config
==========================

Keep selected Laravel config values dynamic after config:cache

v1.0.0(today)00MITPHPPHP ^8.5||^8.4||^8.3CI passing

Since Mar 24Pushed todayCompare

[ Source](https://github.com/GeNyaa/laravel-safe-config)[ Packagist](https://packagist.org/packages/genyaa/laravel-safe-config)[ Docs](https://github.com/genyaa/laravel-safe-config)[ GitHub Sponsors](https://github.com/genyaa)[ RSS](/packages/genyaa-laravel-safe-config/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

Laravel Safe Config
===================

[](#laravel-safe-config)

[![Latest Version on Packagist](https://camo.githubusercontent.com/05e36cf450aa8af5332c5098174fe9a60377bd029e41ea82ce15d089bac69399/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67656e7961612f6c61726176656c2d736166652d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/genyaa/laravel-safe-config)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f9914ef2b8a02140cc984379719d383d22e5d0cda2f32164cb43307e91b0c495/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f67656e7961612f6c61726176656c2d736166652d636f6e6669672f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/genyaa/laravel-safe-config/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/7865f140e8735124c798c9dc24f1be34c9fcd3ed55c20fefe12b48579ca180fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f67656e7961612f6c61726176656c2d736166652d636f6e6669672f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/genyaa/laravel-safe-config/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/319a95684c0f56aee09d259cb2b75664c7f75ba2922f145d306a363f710e2ca9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67656e7961612f6c61726176656c2d736166652d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/genyaa/laravel-safe-config)

`genyaa/laravel-safe-config` overrides Laravel's default `config:cache` command so selected environment variables are not being written as to file values into the cached config file.

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

[](#installation)

You can install the package via composer:

```
composer require genyaa/laravel-safe-config
```

Create a `safe-config.php` file in the root of your Laravel project:

```
php artisan safe-config:install
```

If the file already exists and you want to replace it, use:

```
php artisan safe-config:install --force
```

This file should return a list of environment variable names that must remain secret after config caching:

```
return [
	'APP_KEY',
	'DB_PASSWORD',
	// ...
];
```

Usage
-----

[](#usage)

Once the package service provider is loaded, Laravel resolves `config:cache` through this package.

```
php artisan config:cache
```

Any environment variable listed in your root `safe-config.php` file will be emitted into the cached config file as a runtime `getenv()` lookup.

For example:

```
return [
	'APP_KEY',
	'DB_PASSWORD',
	// ...
];
```

During `config:cache`, the package automatically discovers which config values depend on each listed environment variable by probing fresh configuration snapshots. Those cached config values are then not permanently frozen at cache-build time. When the cache file is loaded, Laravel will read them through `getenv()`, and if `getenv()` returns `false`, the cache falls back to the value that existed when `config:cache` was run.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

[ ![Contributors](https://camo.githubusercontent.com/df8924e7fc761cb1cf7cb45342dc6ffe1f8ec6c289375a7103e5b4de1828c57c/68747470733a2f2f636f6e747269622e726f636b732f696d6167653f7265706f3d47654e7961612f6c61726176656c2d736166652d636f6e666967)](https://github.com/GeNyaa/laravel-safe-config/graphs/contributors)License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49b123e6634789edd9f5e8342a36effd43438df6d80b6a03a166de770ad0f040?d=identicon)[GeNyaa](/maintainers/GeNyaa)

---

Top Contributors

[![GeNyaa](https://avatars.githubusercontent.com/u/7524901?v=4)](https://github.com/GeNyaa "GeNyaa (9 commits)")

---

Tags

laravelgenyaalaravel-safe-config

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/genyaa-laravel-safe-config/health.svg)

```
[![Health](https://phpackages.com/badges/genyaa-laravel-safe-config/health.svg)](https://phpackages.com/packages/genyaa-laravel-safe-config)
```

###  Alternatives

[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13662.4k1](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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