composer extends class not found

1

How to use extends with composer autoloade? The way it is returned the following error:

Fatal error: Class 'App\Modulos\Mail\Mail' not found in ...Google.php on line 7

Composer :

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

Structure :

- Public
    app/
        Modulos/
                Mail/
                     Google.php
                     Mail.php
    vendor/
    bootstrap.php
    cli-config.php
    composer.json
    composer.lock
    index.php
    router.php

Public / index.php

<?php
require __DIR__.'/vendor/autoload.php';

$google = new \App\Modulos\Mail\Google;

var_dump($google);

app / Modules / Mail / Google.php

<?php

namespace Google;

use \App\Modulos\Mail\Mail;

class Google extends Mail {

}

app / Modules / Mail / Mail.php

<?php

namespace Mail;

abstract class Mail {

}
    
asked by anonymous 25.10.2015 / 02:30

1 answer

1

I was able to resolve by changing only the " namespace " in the files:

app / Modules / Mail / Google.php

<?php

namespace App\Modulos\Mail;

use \App\Modulos\Mail\Mail;

class Google extends Mail {

}

app / Modules / Mail / Mail.php

<?php

namespace App\Modulos\Mail;

abstract class Mail {

}
    
25.10.2015 / 03:51