Comments (4)
I've been using a pattern for a quite long time:
<?php
$configLoader = new Container('loader.ini');
$config = $configLoader->config;
[config Respect\Config\Container]
loadFile[] = [default.ini]
loadFile[] = [production.ini]
loadFile[] = [app.ini]
Works pretty well! Perhaps we could institutionalize this pattern. Some kind of:
[this]
loadFile[] = [app.ini]
[conn PDO]
etc = ...
from config.
Yes of course an array! Why didn't I think of that.
@alganet Have you given overwriting preference any thought? I guess we have two options top-down or bottom-up, unless there are something like arrays which I'm not seeing. =)
Dependencies are a non issue as all the values will be loaded before they ever become required, iow the order does not impact dependency unlike overwriting which will require a definitive preference where conflicting properties are found.
from config.
I'm pretty sure the Container
only works from top to bottom. It can handle some missing variables in the way, but I didn't tested with large links between objects missing (which is similar to reading from bottom to top).
Config is pretty fragile. It's magic comes from two limitations: it follows the INI data structure which has limited deepness and it depends on the order of declaration. This limitations also work as reassurance. We can infer a lot more from a limited container and provide runtime flexibility instead of static flexibility. That's why it's code is so hard to change and at the same time so powerful.
from config.
😊 Just remembered what the issue #23 with "Better entropy solver" had to do about: When we load multiple files, we need to load them in the correct order or declare them in the right order. The issue was to solve that kind of problem, seeking for dependencies and the container (ini) whom had more entropy (dependencies) would be loaded later. Does that ring a bell to you @alganet ?
from config.
Related Issues (20)
- Instantiator should not implement __invoke() HOT 3
- Variable references inside sequences may not be working HOT 6
- Lazy loading not working for parameters HOT 3
- Support for builders HOT 3
- Treat unset variables as parameters + Cross-container communication HOT 3
- Prevent InvalidArgumentException to optional arguments HOT 5
- enviroment configuration HOT 16
- Add composer in the README.md HOT 1
- 100% Code coverage HOT 3
- Wrong tags HOT 2
- Constant evaluation HOT 1
- Support for Type Hinting HOT 2
- I dont want expand my password HOT 2
- Reusing lazyLoaded instances bug
- Matching namespaced references HOT 3
- ContainerInterop implementation
- Instantiator Improvements
- Object with underline not parsed correctly HOT 1
- Instantiator not able to resolve __constructor with alone argument HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from config.