LoadEnvironmentVariables
extends LoadEnvironmentVariables
in package
Laravel's `.env` loading, done by Cooper: bound in `bootstrap/app.php` in place of `Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables` (see README.md), which both kernels resolve from the container.
Cooper's Dotenv::export() puts what the files say into the process
environment, so env(), $_ENV, $_SERVER and getenv() -- which
Laravel and its packages read -- find it. That is the only reason it
is exported: the CASC document reads the same files by itself. One
loader, one set of rules, so the two never disagree:
.env.env.<COOPER_ENV>--.env.dev,.env.test,.env.prod;COOPER_ENVfalls back toAPP_ENV,localread asdev,testingastest,productionasprod;.env.local;- the real environment, which always wins: a variable it already has is never overwritten.
php artisan --env=X counts as APP_ENV=X (see NamedEnvironment).
The files are read from $app->environmentPath(). A cached
configuration reads none, as in Laravel.
Table of Contents
Properties
- $options : array<string|int, mixed>
Methods
- __construct() : mixed
- bootstrap() : void
- Exports the `.env` files, unless the configuration is cached.
Properties
$options read-only
private
array<string|int, mixed>
$options
= []
Methods
__construct()
public
__construct([array<string, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string, mixed> = []
-
Cooper's
.envoptions (dotenv,dotenvEnv,dotenvFiles,dotenvDir,dotenvOverride,env); giveLoadConfigurationthe same ones
bootstrap()
Exports the `.env` files, unless the configuration is cached.
public
bootstrap(Application $app) : void
Parameters
- $app : Application
-
the application being bootstrapped