The following example is a bit lengthy, but it attempts to explain why Phalcon uses service location and dependency injection. First, let’s pretend we are developing a component called SomeComponent. This performs a task that is not important now. Our component has some dependency that is a connection to a database.
In this first example, the connection is created inside the component. This approach is impractical; due to the fact we cannot change the connection parameters or the type of databa