yiisoft / config

Configuration management
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
31 stars 11 forks source link

Add merge plan builder by PHP array configuration and flag for disable composer plugin #82

Closed vjik closed 2 years ago

vjik commented 2 years ago

Package yiisoft/config consists of two parts.

Part 1

Getting config $config->get('console') and syntax:

"common": "common/*.php",
"params": [
  "params.php",
  "?params-local.php"
],
"web": [
  "$common",
  "web/*.php"
],
"console": [
  "$common",
  "console/*.php"
],
"events": "events.php",
"events-web": [
  "$events",
  "events-web.php"
],
...

Part 2

Collect configs from vendor and generation of merge plan.

Suggestion

  1. Add flag to composer.json for disable work composer plugin.

  2. Create merge plan builder by PHP array:

<?php
return [
  'options' => [
    'source-directory' => 'config',
  ],
  'configs' => [
    'params' => [
      'params.php',
      '?params-local.php',
    ],
    'common' => 'common/*.php',
    'console' => [
      '$common',
      'console/*.php',
    ],
    ...
  ];
];
...

This approach will allow you to use two ways to configure the application:

1) Configure yiisoft/config in composer.json and collect configs from vendor.

2) Configure yiisoft/config by PHP array and manually create all configs in application.