If you read your config file upon initialization/bootstraping your application AND store it in the DI container, then it will be accessible through that in every part of your app.
Example - bootstrap
$di = new \Phalcon\DI\FactoryDefault();
$configFile = ROOT_PATH . '/app/var/config/config.ini';
// Create the new object
$config = new \Phalcon\Config\Adapter\Ini($configFile);
// Store it in the Di container
$di->set('config', $config);
Now you can access this in your controller as such:
echo $this->config->social->twitter;
Views via Volt:
{{ config.social.twitter }}
You can always set that particular part of your config in your views through a base controller.
class ControllerBase()
{
public function initialize()
{
parent::initialize();
$this->view->setVar('social', $this->config->social);
}
}
If you read your config file upon initialization/bootstraping your application AND store it in the DI container, then it will be accessible through that in every part of your app.
Example - bootstrap
Now you can access this in your controller as such:
Views via Volt:
You can always set that particular part of your config in your views through a base controller.
and then access that variable through your view: