The best way to deal with global wealth

I was wondering if anyone could offer tips on "best practices" for using global state in a web application - PHP in particular, although they need general guidelines like design patterns, etc.

For the moment, I'm just using a static class, calling it Configs. I suppose this looks like using a registry template, but there is certainly a more elegant way to handle global data in an application - I just can't think of it better.

+3
source share
2 answers

Parameters for processing global data in PHP in order of preference:

  • Dependency Inclusion
  • ( , - , )
  • ( )
  • ( klaxon)

, , . , , . , . ( ) .

, , :

+2

, .

Zend_Registry , , Zend Framework.

, , , .

+1

Source: https://habr.com/ru/post/1749852/


All Articles