title: Typo3 Dependency Injection Container
body: <h2>Which class do I use to add new dependency container configurations?</h2>
  
  <pre><code>1. \TYPO3\CMS\Extbase\Object\Container
  2. \TYPO3\CMS\Extbase\Object\ObjectManager
  </code></pre>
  
  <h2>Container has 2 appropriate methods:</h2>
  
  <pre><code>1.1 getInstance ($className, $givenConstructorArguments=array())
  1.2 registerImplementation ($className, $alternativeClassName)
  </code></pre>
  
  <h2>ObjectManager has 2 appropriate methods:</h2>
  
  <pre><code>1. get ($objectName)
  2. create ($objectName)
  </code></pre>
  
  <p><strong>Also:</strong></p>
  
  <h2>Where do I register the dependencies?</h2>
  
  <p>In the global config file /Typo3/LocalConfiguration.php?</p>
  
  <p>What I want is to preconfigure the DI Container singleton with the locations of all public classes.
  My extensions then ask the Container for an object by its name and they get the object back.</p>
  
  <h2>Edit 1:</h2>
  
  <p><strong>I read the question here</strong>
  <a href="https://stackoverflow.com/questions/10604377/how-do-i-include-or-autoload-external-libraries-in-a-typo3-extbase-extension">How do I include or autoload external libraries in a TYPO3 Extbase Extension? + Dependecy Injection?</a><br>
  However what I've noticed is that his classes <strong>register themselves</strong> in the DI Container (using Objectmanager.create)</p>
  
  <p><strong>Additionally I read here</strong>
  <a href="http://forge.typo3.org/projects/typo3v4-mvc/wiki/Dependency_Injection_%28DI%29" rel="nofollow noreferrer">http://forge.typo3.org/projects/typo3v4-mvc/wiki/Dependency_Injection_%28DI%29</a>
  However I still cannot understand how to use the DI Container as a standalone service locator.</p>
  
  <h2>Edit 2:</h2>
  
  <p>Do I perhaps add my dependencies to <strong>/ext/sysext/version/ext_autoload.php ?</strong>
  or
  <strong>/typo3conf/extTables.php</strong></p>