0
Guys I did everything you say in the other questions on the subject, but it didn’t solve my problem. So I opened a new question.
My class is not being found.
this is my structure:
project
_app
|-- User.php
vendor
|-- composer
|-- autoload.php
composer.json
index.php
This is my class:
<?php
namespace project\_app;
class User {}
This is my index:
<?php
require __DIR__ . "/vendor/autoload.php";
use \project\_app\User;
$user = new User;
?>
This is the Commodore:
"autoload": {
"psr-4": {
"project\\": "_app/"
}
}
This is the error returned:
( ! ) Fatal error: Uncaught Error: Class 'project\_app\User' not found in C:\xampp\htdocs\project\index.php on line 18
( ! ) Error: Class 'project\_app\User' not found in C:\xampp\htdocs\project\index.php on line 18
You have _app left in the namespace, or you should create a _app directory inside _app and put User.php there.
– Everton da Rosa