Composer used to make PHP development very easier but not anymore! Now it’s one of requirement for any PHP projects. Now I show you hot to use this awesome and how you fall in love with it!
What is Dependency Injection?
A Dependency is an object that can be used. An Injection is the passing of a dependency (object) to a dependent object that would use it. Eventually, Dependency Injection means giving the object all the dependencies (needed objects).
For example, a
User object uses a
Mailer object to send welcome email. In this example the
Mailer object is a dependency for the
User object. We can ascribe this dependency to classes as well. Now, we should pass
Mailer instance to
User object instead of creating new instance of
Mailer in the
Continue reading Dependency Injection in PHP
Logging is one of the most important parts of software development. When the project getting larger, debugging without a logging system is completely impossible. Developers really need a sufficient logging system!
Logging means store software errors (alerts, warning and so on) with a perfect details. They just could be stored in a directory (In my opinion, the best one), database or even be sent to an email (In my opinion, the worst one!).
Logs illuminates the way of debugging. When error occurs, you won’t tell unknown users the details, just say “Oops!” or something like that, and log all details you need, then you can find the bug easily…