PHP Include class by using "use" with PSR-4

270 views Asked by At

I'm using PSR-4, I defined the psr-4 section on composer.json

"autoload": {
        "classmap":[                
        ],          
        "psr-4": {
            "App\\": "app/"         
        }
},

When I tried to import a class by using "use" keyword

use App\Http\Controllers\Controller;

I get this error: FatalErrorException in UploadFilesController.php line 13: Class 'Controllers\Controller' not found

If I set the static route to the file

include("C:\xampp\...");

it works, but after that found the same problem with other files including PHP clases like Illuminate.

What's the problem?

0

There are 0 answers