Keep selected Laravel config values dynamic after config:cache
genyaa/laravel-safe-config is a Laravel package for keep selected laravel config values dynamic after config:cache.
It currently has 0 GitHub stars and 0 downloads on Packagist (latest version v1.0.0).
Install it with composer require genyaa/laravel-safe-config.
Discover more Laravel packages by genyaa
or browse all Laravel packages to compare alternatives.
Last updated
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.
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',
// ...
];
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.
composer test
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.