-1
I am implementing the namespace with psr-4 in a small PHP application and it turns out that he is not finding the class Mvc\Controller\MyController and I don’t understand the cause
The folder structure is:
src/Controller
src/Model
The class src/Controller/MyController.php that’s how it is
namespace Mvc\Controller;
class MyController
{
    public function listUsers(){
        $model = new \Mvc\Model\MyModel();
        $result = $model->list();
        return $result;
    }
}
The index.php, at the root is:
require_once 'vendor/autoload.php';
print '<h1>Simplest PHP MVC</h1>';
print '<h3>Primeira fase - listar os usuários da tabela.</h3>';
use Mvc\Controller\MyController;
$con = new MyController();
print '<table>';
print '<tr><td><b>ID</td><td><b>Login</td><td><b>Senha</td></tr>';
foreach($con->listUsers() as $user){
    $login = $user->login;
    $id = $user->id;
    $senha = $user->senha;
    print "<tr><td>$id</td><td>$login</td><td>$senha</td>";
    print "<td><a href=\"view/delete.php?id=$id\">Delete</a></td>";
    print "<td><a href=\"view/edit.php?id=$id\">Edit</a></td></tr>";
}
print '</table>';
I’m getting the bug:
Fatal error: Uncaught Error: Class 'Mvc Controller Mycontroller' not found in /var/www/html/mvc/index.php on line 9
If it helps, follow Poser.json
    "autoload":
    {
        "psr-4":
        {
            "Mvc\\" : "src/"
        }
    }
I didn’t get to test it, but take that little bar off
src/in thecomposer.jsonand comments here if it worked.– LipESprY
Check if the name of the files and folders are correct, may have some typing error
– Costamilam
Ever tried to spin one
composer dump-autoload?– chavesfop
Lipespry did not change. Constamilan is all right. chavestop already made.
– Ribamar FS