You aren't importing (or use-ing in PHP parlance) the App\Singleton\Singleton
symbol in your App\DataBase
namespace so PHP assumes that Singleton
is in the same namespace.
In src/DataBase.php
...
namespace App\DataBase;
use App\Singleton\Singleton;
require_once __DIR__ . '/Singleton.php';
class DataBase {
use Singleton;
// and so on
Also, I highly recommend you implement an autoloader strategy (preferably PSR-0) to avoid all the require_once
calls.
Update
To clarify, when you do this...
namespace App\DataBase;
class DataBase { ... }
The full name of this class is \App\DataBase\DataBase
. The namespace
declaration does not include the class / trait names.