php - defining constant values & accessing globally in zend framework 2 -


i new zend2, worked cakephp & codeigniter. want write constant values in particular file & able access them in project.

in cakephp configure::write('environment','dev'); write in file in config folder @ app/config/file name

and can access $env = configure::read('environment'); where..

can in same way in zend framework 2, defining constants in file & can access them anywhere..? please give example how define & read path of file

no short answer. cake, zf1, codeigniter made use of design pattern, discouraged, called the registry pattern (which singleton).

the fact class globally accessible, 1 of reasons why use not advised.

zf2 has different architecture , offers flexible approach merging configuration based on environment variables. when comes 'using' configuration, should injecting services using service manager , service factory.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -