I'd like to store configuration data in separate files and load it/read it using the proper Lithium way.
views:
9answers:
1Depends on what it's for. We pretty strongly discourage throwing around global configuration unless it's managed carefully.
If it's related to connecting to some kind of external system, I'd suggest you take a look at the Connections, Cache, Session, Auth or Logger classes. Take a look here for more info: http://lithify.me/docs/lithium/core/Adaptable
If your configuration doesn't fall into any specific categor(y/ies), and is related to general site operations, take a look at the Environment class: http://lithify.me/docs/lithium/core/Environment. It doesn't have any specific methods to load from files, but it just works with arrays, so if you have a config file that returns an array, you can pass it the value of include "foo.php"
as a parameter.
If you go this route though, be sure that you carefully manage your configuration and don't change it once you've written it. Poor management of this kind of global state is the #1 cause of software bugs.