I am using composer autoloading in PHP.
This code is working fine in my xammp sever as you can see I am passing class as an argument in my router array no error occurred and the class automatically get loaded in Router.php but on live server the class doesn’t get loaded and give errors
The application class is easily loaded in live server too so it means I put the write path in composer.json but it gives error when I pass the class as an argument to router and the router would have to load that class.
<?php
declare(strict_types=1);
$dir = dirname(__DIR__);
require_once $dir."/vendor/autoload.php";
use MuthishimApiFrameworkRequestHandlersAddproduct;
use MuthishimApiFrameworkControllersSiteController;
use DotenvDotenv;
use MuthishimApiFrameworkClassesApplication;
$dotenv = Dotenv::createImmutable($dir);
$dotenv->load();
$app = new Application($dir);
$app->router->get('/', [SiteController::class, 'home']);
This SiteController class is loaded in my xammmp server exactly as it is supposed to be but in live server it doesn’t get loaded and give me class not found error.