title: How do you register a namespace with Silex autoloader
body: <p>I'm experimenting with creating an extension with the <a href="http://silex-project.org">Silex php micro framework</a> for user authentication but I can't seem to get the autoloader to work. Can anyone shed any light?</p>
  
  <p>I have a directory structure like this (truncated)</p>
  
  <pre><code>usertest
  |_lib
  | |_silex.phar
  | |_MyNamespace
  |   |_UserExtension.php
  |   |_User.php
  |_www
    |_index.php
  </code></pre>
  
  <p>The pertinent bits of index.php, which serves as the bootstrap and the front controller look like this:</p>
  
  <pre><code>require '../lib/silex.phar';
  
  use Silex\Application;
  use MyNamespace\UserExtension;
  
  $app = new Application();
  $app['autoloader']-&gt;registerNamespace( 'MyNamespace', '../lib' );
  $app-&gt;register( new UserExtension() );
  </code></pre>
  
  <p>The class I'm trying to load looks similar this:</p>
  
  <pre><code>namespace MyNamespace;
  
  use Silex\Application;
  use Silex\ExtensionInterface;
  
  class UserExtension implements ExtensionInterface {
      public function register( Application $app ) {
          $app['user'] = $app-&gt;share( function() use( $app ) {
              return new User();
          });
      }
  }
  </code></pre>
  
  <p>All pretty straight forward except it throws this error:</p>
  
  <pre><code>Fatal error: Class 'MyNamespace\UserExtension' not found in /home/meouw/Projects/php/usertest/www/index.php on line 8
  </code></pre>
  
  <p>I have dabbled with symfony2 and have successfully followed the <a href="http://symfony.com/doc/2.0/cookbook/tools/autoloader.html">instructions for setting up the universal class loader</a>, but in this instance I am stumped. Am I missing something? Any help would be appreciated.</p>