hathoora\container
in Hathoora PHP Framework is an object created to hold other objects that are accessed, placed, and maintained
with the class methods of the container.
It is the gateway to accessing anything available in the framework.
Some components like contoller, model, database etc already extend container. If you need to access container outside these components then you:
hathoora\container
class.hathoora\container
methods statically.Using conatiner you can have access to the following components:
getKernel()
for hathoora\kernel
getObserver()
for hathoora\observer
getRouteRequest()
for hathoora\route\request
getRouteDispatcher()
for hathoora\route\dispatcher
getController()
for hathoora\controller\base
getResponse()
for hathoora\http\response
getRequest()
for hathoora\http\request
Below are some example of getting & setting configurations.
// get an array of all configurations
\hathoora\container::getAllConfig();
// check if has config
\hathoora\container::hasConfig('hathoora');
// get key configurations - returns array in this case
\hathoora\container::getConfig('hathoora');
// or get nested configurations - returns single value in this case
\hathoora\conatiner::getConfig('hathoora.logger.profiling.enabled');
// where $value can be an int, string, object, array - anything.
\hathoora\container::setConfig($key, $value)