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