My autoload by the composer is not working

0

I'm learning to do autoload using the composer, but I'm getting the following error while performing the tests:

  

Fatal error: Class 'App \ Model \ Database' not found in /var/www/Library/index.php on line 5

It's like he's not finding the DataBase class, and I do not know why anyone could help me?

Code:

composer.json:

 {
    "autoload": {
        "psr-4": {
            "App\" : "App/"
        }
    }
}

DataBase.php

<?php

namespace App\Model;

class Database
{
    ...

index.php

    <?php

use App\Model\DataBase;

$pdo = Database::conexao();
    
asked by anonymous 01.07.2017 / 21:23

1 answer

0

I've been able to resolve, have failed to include autoload in index.php

require_once 'vendor/autoload.php';
    
01.07.2017 / 21:42