for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yiisoft\Composer\Config\Configs;
/**
* Params class represents output configuration file with params definitions.
*/
class Params extends Config
{
protected function calcValues(array $sources): array
return $this->pushEnvVars(parent::calcValues($sources));
}
protected function pushEnvVars(array $vars): array
if ($vars === []) {
return [];
$env = array_merge(
$this->builder->getConfig('envs')->getValues(),
$this->builder->getConfig('dotenv')->getValues()
);
foreach ($vars as $key => &$value) {
if (is_array($value)) {
foreach (array_keys($value) as $subkey) {
$envKey = $this->getEnvKey($key . '_' . $subkey);
if (isset($env[$envKey])) {
$value[$subkey] = $env[$envKey];
} else {
$envKey = $this->getEnvKey($key);
$vars[$key] = $env[$envKey];
return $vars;
private function getEnvKey(string $key): string
return strtoupper(strtr($key, '.-', '__'));
public function paramsRequires(): bool
return false;