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
Post a Comment