title: Autoload PHP Classes using Composer
body: <p>I am trying for the first time to autoload PHP Classes using Composer.</p>
  
  <p>I have this dir structure:</p>
  
  <pre><code>-app
    -controllers
    -models
      -MySql.php
      -interfaces
        -IDatabase.php
  </code></pre>
  
  <p>My problem is that I am not able to implement the <code>IDatabase interface</code> in my <code>MySql</code> class. It gives me: <code>Fatal error: Interface 'App\Models\I\IDatabase' not found</code>.</p>
  
  <p><strong>composer.json</strong></p>
  
  <pre><code>{
    "autoload": {
      "psr-4": {
        "App\\": "app/"
      }
    }
  }
  </code></pre>
  
  <p><strong>IDatabase.php</strong></p>
  
  <pre><code>namespace App\Models\I;
  
  interface IDatabase
  {
  
    public function connect();
    public function execute($query,$param);
  }
  </code></pre>
  
  <p><strong>Mysql.php</strong></p>
  
  <pre><code>namespace App\Models;
  
  use App\Models\I\IDatabase;
  
  class MySql implements IDatabase
  {
  ...
  }
  </code></pre>
  
  <p>What am I doing wrong? I can't figure it out. Thanks.</p>