On application start I’m creating Config object (Singleton). How could I make Config object be available inside Model and Controller? Should I pass Config object to constructor as method parametr or I should better use $this->config = Config::getInstance()? Any other methods?
Thank you
Singleton is essentially just fancy syntax for a global variable, and is as bad as globals are (and they are bad). Passing a parameter is the cleanest option as it creates no hard coupling between classes and allows for maximum flexibility. Another reasonable (but rather advanced) option is to use a dependency injection container, see for example this post.