From 43532f5b5c96011fa07ce1bf45279203bc7b2f63 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Mon, 15 Apr 2024 09:15:49 -0300 Subject: [PATCH 01/14] Docs folder standardization and other fixes --- README.md | 17 ++++++++++------- docs/internals.md | 40 ++++++++++++++++++++++++++++++++++++++++ psalm.xml | 2 +- psalm80.xml | 2 +- 4 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 docs/internals.md diff --git a/README.md b/README.md index 57ad6ed..16ab909 100644 --- a/README.md +++ b/README.md @@ -105,29 +105,33 @@ each package `composer.json`: In the above example the mapping keys are config group names and the values are configuration files and references to other config groups. The file paths are relative to the [source-directory](#source-directory), which by default is the path where `composer.json` is located. - -### Markers +### Markers - `?` - marks optional files. Absence of files not marked with this marker will cause exception. + ``` "params": [ "params.php", "?params-local.php" ] ``` + It's okay if `params-local.php` will not be found, but it's not okay if `params.php` will be absent. - `*` - marks wildcard path. It means zero or more matches by wildcard mask. + ``` "web": [ "../src/Modules/*/config/web.php" ] ``` + It will collect all `web.php` in any sub-folders of `src/Modules/` in `config` folder. However, if the configuration folder is packaged as part of the `PHAR` archive, the configuration files will not be uploaded. In this case, you must explicitly specify each configuration file. - `$` - reference to another config by its group name. + ``` "params": [ "params.php", @@ -142,6 +146,7 @@ The file paths are relative to the [source-directory](#source-directory), which "params-web.php" ] ``` + The config groups `params-console` and `params-web` will both contain the config values from `params.php` and `params-local.php` additional to their own configuration values. *** @@ -149,8 +154,6 @@ The file paths are relative to the [source-directory](#source-directory), which Define your configs like the following: ```php - [ 'db' => [ @@ -177,7 +180,7 @@ $config = new Config( ); ``` -You can pass `null` as `$params` group name. In this case `$params` will empty array. +You can pass `null` as `$params` group name. In this case `$params` will empty array. ### Using sub-configs @@ -438,7 +441,7 @@ return [ ]; ``` -If you specify the file path, the remaining sections (`config-plugin-*`) in `composer.json` will be ignored and +If you specify the file path, the remaining sections (`config-plugin-*`) in `composer.json` will be ignored and configurations will be read from the PHP file specified. The path is relative to where the `composer.json` file is located. @@ -687,7 +690,7 @@ Maintained by [Yii Software](https://www.yiiframework.com/). ## Credits The plugin is heavily inspired by [Composer config plugin](https://github.com/yiisoft/composer-config-plugin) -originally created by HiQDev (https://hiqdev.com/) in 2016 and then adopted by Yii. +originally created by HiQDev () in 2016 and then adopted by Yii. ## Support the project diff --git a/docs/internals.md b/docs/internals.md new file mode 100644 index 0000000..6ef50da --- /dev/null +++ b/docs/internals.md @@ -0,0 +1,40 @@ +# Internals + +## Unit testing + +The package is tested with [PHPUnit](https://phpunit.de/). To run tests: + +```shell +./vendor/bin/phpunit +``` + +## Mutation testing + +The package tests are checked with [Infection](https://infection.github.io/) mutation framework with +[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it: + +```shell +./vendor/bin/roave-infection-static-analysis-plugin +``` + +## Static analysis + +The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: + +```shell +./vendor/bin/psalm +``` + +## Code style + +Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or +use either newest or any specific version of PHP: + +```shell +./vendor/bin/rector +``` + +## Dependencies + +Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive +[Composer](https://getcomposer.org/) dependencies. diff --git a/psalm.xml b/psalm.xml index b48c894..c338142 100644 --- a/psalm.xml +++ b/psalm.xml @@ -3,7 +3,7 @@ errorLevel="1" findUnusedBaselineEntry="true" findUnusedCode="false" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" > diff --git a/psalm80.xml b/psalm80.xml index d091d59..2c7c1f8 100644 --- a/psalm80.xml +++ b/psalm80.xml @@ -3,7 +3,7 @@ errorLevel="1" findUnusedBaselineEntry="true" findUnusedCode="false" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" > From 5bd90072bf2f9409dc913d9d989e3155764a1bf5 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:34:36 -0300 Subject: [PATCH 02/14] Update internals.md --- docs/internals.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/internals.md b/docs/internals.md index 6ef50da..9954ded 100644 --- a/docs/internals.md +++ b/docs/internals.md @@ -38,3 +38,9 @@ use either newest or any specific version of PHP: Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive [Composer](https://getcomposer.org/) dependencies. + +To run the checker, execute the following command: + +```shell +./vendor/bin/composer-require-checker +``` From cf60dee162050218aa864903fbbce5939a95e018 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:55:39 -0300 Subject: [PATCH 03/14] Update internals.md --- docs/internals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/internals.md b/docs/internals.md index 9954ded..b715d9f 100644 --- a/docs/internals.md +++ b/docs/internals.md @@ -25,7 +25,7 @@ The code is statically analyzed with [Psalm](https://psalm.dev/). To run static ./vendor/bin/psalm ``` -## Code style +## Rector Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or use either newest or any specific version of PHP: From 9650adca126c112e7f04571d191614c917e78767 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:06:38 -0300 Subject: [PATCH 04/14] IRC link fix --- composer.json | 2 +- psalm.xml | 2 +- psalm80.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 2399ca2..443ecc3 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "issues": "https://github.com/yiisoft/config/issues?state=open", "forum": "https://www.yiiframework.com/forum/", "wiki": "https://www.yiiframework.com/wiki/", - "irc": "irc://irc.freenode.net/yii", + "irc": "ircs://irc.libera.chat:6697/yii", "chat": "https://t.me/yii3en", "source": "https://github.com/yiisoft/config" }, diff --git a/psalm.xml b/psalm.xml index c338142..b48c894 100644 --- a/psalm.xml +++ b/psalm.xml @@ -3,7 +3,7 @@ errorLevel="1" findUnusedBaselineEntry="true" findUnusedCode="false" - xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" > diff --git a/psalm80.xml b/psalm80.xml index 2c7c1f8..d091d59 100644 --- a/psalm80.xml +++ b/psalm80.xml @@ -3,7 +3,7 @@ errorLevel="1" findUnusedBaselineEntry="true" findUnusedCode="false" - xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" > From b83bcd9099f38bff2cb65806b7c4458e0b843078 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Thu, 18 Apr 2024 19:29:08 -0300 Subject: [PATCH 05/14] Docs folder standardization and other fixes --- LICENSE.md | 8 +++---- README.md | 55 ++++++++++++++--------------------------------- docs/internals.md | 5 ++--- 3 files changed, 22 insertions(+), 46 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index bc5674f..6a920d6 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,17 +1,17 @@ -Copyright © 2008 by Yii Software (https://www.yiiframework.com/) +Copyright © 2008 by Yii Software () All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Yii Software nor the names of its +* Neither the name of Yii Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/README.md b/README.md index 16ab909..a9acdcd 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ The file paths are relative to the [source-directory](#source-directory), which - `?` - marks optional files. Absence of files not marked with this marker will cause exception. - ``` + ```php "params": [ "params.php", "?params-local.php" @@ -120,7 +120,7 @@ The file paths are relative to the [source-directory](#source-directory), which - `*` - marks wildcard path. It means zero or more matches by wildcard mask. - ``` + ```php "web": [ "../src/Modules/*/config/web.php" ] @@ -132,7 +132,7 @@ The file paths are relative to the [source-directory](#source-directory), which - `$` - reference to another config by its group name. - ``` + ```php "params": [ "params.php", "?params-local.php" @@ -373,7 +373,7 @@ we use `$web` configuration from the main environment. This configuration has the following structure: -``` +```text config/ Configuration root directory. dev/ Development environment files. app.php Development environment app group configuration. @@ -653,44 +653,14 @@ composer yii-config-info composer yii-config-info yiisoft/widget ``` -## Testing - -### Unit testing - -The package is tested with [PHPUnit](https://phpunit.de/). To run tests: - -```shell -./vendor/bin/phpunit --testdox --no-interaction -``` - -### Mutation testing - -The package tests are checked with [Infection](https://infection.github.io/) mutation framework with -[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it: - -```shell -./vendor/bin/roave-infection-static-analysis-plugin -``` - -### Static analysis +## Documentation -The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: +- More information can be found in the [Internals.](docs/internals.md) -```shell -./vendor/bin/psalm -``` - -## License - -The config package is free software. It is released under the terms of the BSD License. -Please see [`LICENSE`](./LICENSE.md) for more information. - -Maintained by [Yii Software](https://www.yiiframework.com/). +## Support -## Credits - -The plugin is heavily inspired by [Composer config plugin](https://github.com/yiisoft/composer-config-plugin) -originally created by HiQDev () in 2016 and then adopted by Yii. +If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that. +You may also check out other [Yii Community Resources](https://www.yiiframework.com/community). ## Support the project @@ -703,3 +673,10 @@ originally created by HiQDev () in 2016 and then adopted by [![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en) [![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk) [![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack) + +## License + +The Yii Access is free software. It is released under the terms of the BSD License. +Please see [`LICENSE`](./LICENSE.md) for more information. + +Maintained by [Yii Software](https://www.yiiframework.com/). diff --git a/docs/internals.md b/docs/internals.md index b715d9f..8dc4049 100644 --- a/docs/internals.md +++ b/docs/internals.md @@ -34,10 +34,9 @@ use either newest or any specific version of PHP: ./vendor/bin/rector ``` -## Dependencies +## Composer require checker -Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive -[Composer](https://getcomposer.org/) dependencies. +This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all dependencies are correctly defined in `composer.json`. To run the checker, execute the following command: From 43cce843eddf62af24e463b9095ac138ecd02ee4 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Sat, 20 Apr 2024 06:59:49 -0300 Subject: [PATCH 06/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a9acdcd..72b1575 100644 --- a/README.md +++ b/README.md @@ -676,7 +676,7 @@ You may also check out other [Yii Community Resources](https://www.yiiframework. ## License -The Yii Access is free software. It is released under the terms of the BSD License. +The Yii Config package is free software. It is released under the terms of the BSD License. Please see [`LICENSE`](./LICENSE.md) for more information. Maintained by [Yii Software](https://www.yiiframework.com/). From 979d46cd49b0775c53831bf5719444d2ff9c49bf Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Sun, 21 Apr 2024 06:23:23 -0300 Subject: [PATCH 07/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72b1575..f856bf0 100644 --- a/README.md +++ b/README.md @@ -655,7 +655,7 @@ composer yii-config-info yiisoft/widget ## Documentation -- More information can be found in the [Internals.](docs/internals.md) +- [Internals](docs/internals.md) ## Support From 033701e11dbb30bf7ba9ec0d2a84ebcfe0effca3 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:14:20 -0300 Subject: [PATCH 08/14] Update README.md Co-authored-by: Alexander Makarov --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f856bf0..87918ba 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,6 @@ The file paths are relative to the [source-directory](#source-directory), which ### Markers - `?` - marks optional files. Absence of files not marked with this marker will cause exception. - ```php "params": [ "params.php", From 840189373e47412877f33f4fc624206d8936156b Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:14:37 -0300 Subject: [PATCH 09/14] Update README.md Co-authored-by: Alexander Makarov --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 87918ba..8829cfe 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,6 @@ The file paths are relative to the [source-directory](#source-directory), which "?params-local.php" ] ``` - It's okay if `params-local.php` will not be found, but it's not okay if `params.php` will be absent. - `*` - marks wildcard path. It means zero or more matches by wildcard mask. From 8637a5a672c36c761dfad8a742c6c1e76caa74ba Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:14:47 -0300 Subject: [PATCH 10/14] Update README.md Co-authored-by: Alexander Makarov --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 8829cfe..d1a3d8e 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,6 @@ The file paths are relative to the [source-directory](#source-directory), which It's okay if `params-local.php` will not be found, but it's not okay if `params.php` will be absent. - `*` - marks wildcard path. It means zero or more matches by wildcard mask. - ```php "web": [ "../src/Modules/*/config/web.php" From 210cf79891ae9c3471884c5f6119fe5cfc13134d Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:15:01 -0300 Subject: [PATCH 11/14] Update README.md Co-authored-by: Alexander Makarov --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d1a3d8e..7c741a6 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,6 @@ The file paths are relative to the [source-directory](#source-directory), which "../src/Modules/*/config/web.php" ] ``` - It will collect all `web.php` in any sub-folders of `src/Modules/` in `config` folder. However, if the configuration folder is packaged as part of the `PHAR` archive, the configuration files will not be uploaded. In this case, you must explicitly specify each configuration file. From 08c24dd198edcaff95ce663233958927881b569a Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:15:09 -0300 Subject: [PATCH 12/14] Update README.md Co-authored-by: Alexander Makarov --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 7c741a6..7ab2670 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,6 @@ The file paths are relative to the [source-directory](#source-directory), which files will not be uploaded. In this case, you must explicitly specify each configuration file. - `$` - reference to another config by its group name. - ```php "params": [ "params.php", From 520f2e270f9a40cf84811e76e250e1494dc49e17 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:15:19 -0300 Subject: [PATCH 13/14] Update README.md Co-authored-by: Alexander Makarov --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 7ab2670..d4f3100 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,6 @@ The file paths are relative to the [source-directory](#source-directory), which "params-web.php" ] ``` - The config groups `params-console` and `params-web` will both contain the config values from `params.php` and `params-local.php` additional to their own configuration values. *** From 3a5c2640e61d029f0e771ea866f6e093c99ce8f0 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:16:37 -0300 Subject: [PATCH 14/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f856bf0..2cc1301 100644 --- a/README.md +++ b/README.md @@ -373,7 +373,7 @@ we use `$web` configuration from the main environment. This configuration has the following structure: -```text +``` config/ Configuration root directory. dev/ Development environment files. app.php Development environment app group configuration.