title: Dependencies and Instantiation
body: <p>I'm in the middle of trying to move components of my website into classes. This snippet below for example needs to be used in multiple files, but I don't want to copy and paste the code around.</p>
  
  <pre><code>&lt;?php
  ...
  require "ActionManager.php";
  require "Action.php";
  require "includes/pdo.php";
  
  $actionMan = new ActionManager();
  $actionMan-&gt;setPDO($pdo);
  $actionMan-&gt;setUserData($data);
  echo $actionMan-&gt;getActions(3);
  ?&gt;
  </code></pre>
  
  <p>Okay I know I could use spl_autoload_register() to get rid of the first two requires, but I think what I'm looking for is some kind of dependency container, so that I don't end up repeating this code, and screwing myself over when it changes.</p>
  
  <p>Also I find myself repeating the setPDO() and setUserData() methods in a LOT of classess.</p>
  
  <p>Could someone kindly point me in the right direction?</p>