I have a question as I need to have a global static variable and I have question is any possibility to add it to the application.ini file, how to do it?
Or I have to:
I wouldn't use the Zend_Registry nor constants, for two reasons
What the best option is, is to directly get the config object from the bootstrap. In next examples, I assume you have this in your application.ini:
someservice.apikey = 12345678
someservice.passkey = 87654321
The bootstrap is set as a parameter in the frontController. If you have an action controller, this makes it as simple as this:
$serviceOptions = $this->getInvokeArg('bootstrap')->getOption('someservice');
If you have a service instantiated in your controller, you now can pass them on through the constructor and/or setter.
If you want to get the options not within your controller, but somewhere else, you can use the singleton pattern the frontController implements. So at any place (of course only during dispatching, not during the bootstrap itself) you're able to do this:
$frontController = Zend_Controller_Front::getInstance();
$serviceOptions = $frontController->getParam('bootstrap')
->getOption('someservice');
With above method you're safe you have always the right configuration option and not some possibly mutated one.