/** * @override * @inheritDoc */ public function setEnvironmentVariable($name, $value = null) { if (strpos($name, 'INI_') === 0) { list($name, $value) = $this->normaliseEnvironmentVariable($name, $value); $normalized = str_replace('INI_', '', $name); $normalized = strtolower($normalized); $this->invoker->call('ini_set', [$normalized, $value]); } parent::setEnvironmentVariable($name, $value); }
/** * @inheritDoc */ public function boot() { $filePath = rtrim($this->kernel->getRootPath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '.env'; $envLoader = new Loader($filePath); if ($this->kernel->isCli()) { /** @var InputInterface $consoleInput */ $consoleInput = $this->container->get(InputInterface::class); $env = $consoleInput->getParameterOption(['--env', '-e']); if ($env) { $envLoader->setEnvironmentVariable('APP_ENV', $env); } } }