title: Loading third party library: not found
body: <p>I am trying to include a third party library into my Symfony 2 project as explained <a href="http://www.kiwwito.com/article/add-third-party-libraries-to-symfony-2" rel="nofollow">here</a>. However, I keep getting the error message <code>Fatal error: Class 'Sprain_Images' not found in /src/MyProject/MyBundle/Controller/BackendController.php on line 267</code>.</p>
  
  <p>Here is what I did:</p>
  
  <p>I put a third party class into the src folder (not directly in vendors because this class is not available to be loaded by deps).</p>
  
  <pre><code>#Directory structure
  -src
    -MyProject
    -vendor
       -sprain
         -lib
           -Images
             -src
             Images.php
  </code></pre>
  
  <p>Then I created the class to be used:</p>
  
  <pre><code> # /src/vendor/sprain/lib/Images/Images.php
   require_once __DIR__.'/src/class.Images.php';
   class Sprain_Images extends Images {
   }
  </code></pre>
  
  <p>I also registered the prefix in autoload.php:</p>
  
  <pre><code># /app/autoload.php
  $loader-&gt;registerPrefixes(array(
    'Twig_Extensions_' =&gt; __DIR__.'/../vendor/twig-extensions/lib',
    'Twig_'            =&gt; __DIR__.'/../vendor/twig/lib',
    'Sprain_'          =&gt; __DIR__.'/../src/vendor/sprain/lib',
  ));
  </code></pre>
  
  <p>And eventually I called the class in my controller:</p>
  
  <pre><code># /src/MyProject/MyBundle/Controller/BackendController.php
  $image = new \Sprain_Images();
  </code></pre>
  
  <p>However the class is not being found. Where did I make the mistake?</p>