title: Dependency Injection Container PHP
body: <p>I've recently learned about the advantages of using Dependency Injection (DI) in my PHP application. </p>
  
  <p>However, I'm still unsure how to create my container for the dependencies. Before, I use a container from a framework and I want to understand how is he doing things in back and reproduce it.</p>
  
  <p>For example:</p>
  
  <p>The container from Zend 2. I understand that the container make class dynamic, he does not have to know about them from the beginning, he checks if he already has that class in his registry and if he has not he check if that class exist and what parameters has inside constructor and put it in his own registry so next time could take it from there, practical is doing everything dynamic and it is completing his own registry, so we do not have to take care of nothing once we implement the container as he can give as any class we want even if we just make that class.</p>
  
  <p>Also if I want to <code>getInstance</code> for A which needs B and B needs C I understand that he doing this recursive and he goes and instantiate C then B and finally A.</p>
  
  <p>So I understand the big picture and what is he suppose to do but I am not so sure about how to implement it.</p>