Download the PHP package mradcliffe/laravel-settings-injector without Composer
On this page you can find all versions of the php package mradcliffe/laravel-settings-injector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mradcliffe/laravel-settings-injector
More information about mradcliffe/laravel-settings-injector
Files in mradcliffe/laravel-settings-injector
Package laravel-settings-injector
Short Description Laravel Settings Injector
License MIT
Homepage https://github.com/mradcliffe/laravel-settings-injector
Informations about the package laravel-settings-injector
Laravel Settings Injector
laravel-settings-injector provides a bootstrapper replacement for the default LoadConfiguration bootstrapper from Laravel.
This allows you to create a directory to manage settings from outside of the application directory with symlinks so that various environment-specific variables can be managed at a systems-level for production and other internal enviroments.
This is probably not useful for many installations of Laravel, however due to recommendations of not using dotenv files for production environment variables this is necessary to obfuscate production variables from the application repository. The advantage is that the variables are scoped to LoadConfiguration instead of using global environment variables.
Installation
Configuration
- Modify
app/Http/Kernel.php. - Replace
\Illuminate\Foundation\Bootstrap\LoadConfigurationwith\Radcliffe\LaravelSettingsInjector\Bootstrap\LoadConfigurationeither by modifying an existing::$bootstrappersprotected variable or doing so within the::bootstrappers()method of that class. - Modify
app/Console/Kernel.phpand add\Illuminate\Foundation\Console\Kernel::$bootstrappersprotected variables to there, and do the same replacement as in #2 above.
Usage
See tests directory for some example fixtures.
- Create a
settingsdirectory in app root. - Provision files outside of the webroot, but required somehow by
settings/settings.php. See image below. - Use those variables as normal in
config/*.phpto configure your application.- Note that any defines or requires could potentially happen more than once due to the way that Laravel works. Specifically
artisan config:cachewill load configuration after configuration has already been loaded so any use ofdefineorrequirewithinsettings/settings.phpor any file it requires needs to take that into consideratino.
- Note that any defines or requires could potentially happen more than once due to the way that Laravel works. Specifically