title: extending a class with namespace in PHP
body: <p>I'm trying to write my first framework with namespaces.
  I've got a problem with extending class Controller.
  I get </p>
  
  <blockquote>
    <p>Fatal error: Class 'Controller' not found in xxx/src/controllers/index.php on line 3</p>
  </blockquote>
  
  <p>A Controller looks that:</p>
  
  <pre><code>namespace src\libs;
  class Controller 
  {}
  </code></pre>
  
  <p>And here is my Index class in <code>src/controllers/</code></p>
  
  <pre><code>namespace src\controllers;
  use src\libs as libs;
  class Index extends libs\Controller
  {}
  </code></pre>
  
  <p>My autoload:</p>
  
  <pre><code>function autoLoader($class)
  {
      $class = str_replace('\\', '/', $class);
      if (file_exists('./' . $class . '.php')) {
          require( './' . $class . '.php');
      } else {
          $class = explode('/', $class);
          if (file_exists( LIBS . end($class) . '.php')) { 
              require( LIBS . end($class) . '.php');
          } else {
              echo 'Critical error!!';
              exit;
          }
      }   
  }
  </code></pre>
  
  <blockquote>
    <p>LIBS = ./src/libs/</p>
  </blockquote>
  
  <p>AutLoader works, because it includes file with class Controller, I don't get error. I have not idea why it isn't work.</p>