The problem was that use needs backslash for the spacename and include needs slash for the path of the file.php where I have the classes. I’m on MacOS X and I read using a Mac generates this kind of problem.
The solution was using a str_replace to convert \ in /.
function monAutoLoad($class) {
include(str_replace("\\", "/", $class). ".php");
}
spl_autoload_register('monAutoLoad');
use MesProduits\Produit;
CLICK HERE to find out more related problems solutions.