I have a project with this structure:
/root
/api/class/user.php
/api/autoload.php
/api/api.php
/index.php
index.php
./api/autload.php
autoload.php
class/user.php
api.php
config.php -> I define some constant
autoload.php -> require config.php + require all my class
api.php -> I require autolaod.php
index.php -> I require api.php
define( "LIB_PATH", "lib" );
define( "CLASS_PATH", "class" );
require( LIB_PATH . "/jwt.php" );
require( CLASS_PATH . "/progetto.php" );
require( CLASS_PATH . "/azienda.php" );
require( CLASS_PATH . "/entrata.php" );
require( CLASS_PATH . "/uscita.php" );
require( CLASS_PATH . "/user.php" );
From what you wrote, the api.php doesn't have class/user.php required. class/user.php is required only in index.php (through autoload.php) and in api.php (directly).
The solution is to add require('./class/user.php')
in the api.php file.
EDIT
Good approach would be to have all requires of class files in the autoload.php and require the autoload to index.php, api.php, and all other new files where needed.
The edit in the answer now looks like good solution.