Hi, I'm starting to use yii 3.0 to make some proof of concept and to learn new features from Yii3.0 before it is released.
I have a question about all the config files created in yiisoft/yii-core
and other libraries/modules:
The use of https://github.com/hiqdev/composer-config-plugin is really great but I don't understand why some parameters are defined in https://github.com/yiisoft/yii-core/blob/master/config/params.php and used in https://github.com/yiisoft/yii-core/blob/master/config/common.php#L27.
This force the final developper to override keys defined in https://github.com/yiisoft/yii-core/blob/master/config/params.php in its own params.php
file which will be cluttered.
I don't think it's a good idea as those values are already hardcoded in yiisoft/yii-core
For example
right now we have :
https://github.com/yiisoft/yii-core/blob/master/config/params.php
return [
'app.id' => 'core',
'app.name' => 'Core',
'app.language' => 'en',
];
and in https://github.com/yiisoft/yii-core/blob/master/config/common.php
...
'app' => [
'id' => $params['app.id'],
'name' => $params['app.name'],
'language' => $params['app.language'],
'aliases' => array_merge($aliases, [
'@root' => YII_ROOT,
'@vendor' => '@root/vendor',
'@public' => '@root/public',
'@runtime' => '@root/runtime',
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
]),
'params' => $params,
],
...
Why do not leave https://github.com/yiisoft/yii-core/blob/master/config/params.php empty
and define hardcoded values in https://github.com/yiisoft/yii-core/blob/master/config/common.php
...
'app' => [
'id' => 'core',
'name' => 'Core',
'language' => 'en',
'aliases' => array_merge($aliases, [
'@root' => YII_ROOT,
'@vendor' => '@root/vendor',
'@public' => '@root/public',
'@runtime' => '@root/runtime',
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
]),
'params' => $params,
],
...
This way, app configuration will be done by the developper as it was before :
in app/params.php
return [
'myparam1' => 'value1',
];
and app/common.php
return [
'app' => [
'id' => 'my-app',
'name' => 'My own Application',
'language' => 'fr',
],
]
and this will leave params.php
dedicated to application parameters which will be more clear.