title: PHP Fatal error: Interface not found, using factory pattern with namespaces
body: <p>File 1 - <code>/Users/jitendraojha/www/DesignPatternsWithPhpLanguage/FactoryPattern/FactoryClassPattern/UserInterface.php</code></p>
  
  <pre><code>&lt;?php
  
  namespace DesignPatternsWithPhpLanguage\FactoryPattern\FactoryClassPattern;
  
  interface UserInterface
  {
  
      function setFirstName($firstName);
      function getFirstName();
  }
  
  ?&gt;
  </code></pre>
  
  <p>File 2 - <code>/Users/jitendraojha/www/DesignPatternsWithPhpLanguage/FactoryPattern/FactoryClassPattern/User.php</code></p>
  
  <pre><code>&lt;?php
  
  namespace DesignPatternsWithPhpLanguage\FactoryPattern\FactoryClassPattern;
  
  
  class User implements UserInterface
  {
  
      private $firstName = null;
  
      public function __construct($params) {   }
  
      public function setFirstName($firstName)
      {
  
          $this-&gt;firstName = $firstName;
      }
  
      public function getFirstName()
      {
  
          return $this-&gt;firstName;
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p><strong>Problem</strong></p>
  
  <p><code>php FactoryPattern/FactoryClassPattern/UserInterface.php</code> - Runs fine.</p>
  
  <p><code>php FactoryPattern/FactoryClassPattern/User.php</code> - gives following errors: <em>PHP Fatal error:  Interface 'DesignPatternsWithPhpLanguage\FactoryPattern\FactoryClassPattern\UserInterface' not found in /Users/jitendraojha/www/DesignPatternsWithPhpLanguage/FactoryPattern/FactoryClassPattern/User.php on line 7</em></p>
  
  <p>I had <code>use UserInterface;</code> added in File 2 with no solution.</p>