|
1 | 1 | # Benefits |
2 | 2 |
|
| 3 | +## Summary |
| 4 | + |
| 5 | +Lists the benefits of using a ConfigProvider, including centralized, modular, container-friendly, and testable configuration. |
| 6 | + |
| 7 | +## Details |
| 8 | + |
3 | 9 | - **Centralized setup** – Instead of hardcoding bootstrap code, you declare it in a config provider so it's easy to read, change, or extend. |
4 | 10 | - **Modular** – Each package can ship with its own config without interfering with others. |
5 | 11 | - **Container-friendly** – It works well with frameworks using DI containers like Laminas ServiceManager, PHP-DI, or Pimple. |
6 | | -- **Standardized service definitions** - It has consistent rules for object creation that are separate from business logic. |
7 | | -- **Environment-agnostic** - It returns an array that defines dev, test, or prod environments. |
8 | | -- **Testability** - The consistent, central configuration promotes isolated (e.g. per-module) testing, easier swapping of dependencies and the assertion of pipeline setup (e.g. check if a config key is present). |
| 12 | +- **Standardized service definitions** – It has consistent rules for object creation that are separate from business logic. |
| 13 | +- **Environment-agnostic** – It returns an array that defines dev, test, or prod environments. |
| 14 | +- **Testability** – The consistent, central configuration promotes isolated (e.g. per-module) testing, easier swapping of dependencies and the assertion of pipeline setup (e.g. check if a config key is present). |
9 | 15 |
|
10 | 16 | > **Dotkernel ConfigProviders** have to be **added manually** in `config/config.php`, because all the initial ConfigProviders required to install the applications are already injected. |
| 17 | +
|
| 18 | +## FAQ |
| 19 | + |
| 20 | +**Q: Why use a ConfigProvider instead of hardcoding bootstrap code?** |
| 21 | +A: It centralizes configuration so it's easy to read, change, or extend. |
| 22 | + |
| 23 | +**Q: Does a ConfigProvider work with dependency injection containers?** |
| 24 | +A: Yes, it's container-friendly and works with DI containers like Laminas ServiceManager, PHP-DI, or Pimple. |
| 25 | + |
| 26 | +**Q: Do I need to register Dotkernel ConfigProviders manually?** |
| 27 | +A: Yes, Dotkernel ConfigProviders must be added manually in `config/config.php`. |
| 28 | + |
| 29 | +## See also |
| 30 | + |
| 31 | +- [Introduction](introduction.md) |
| 32 | +- [How the ConfigProvider works](functionality.md) |
0 commit comments