Hello im having a problem calling the controller class and and a method, basically Slim throws an error sayings Cannot call index on App\Controllers\HomeController because it is not a class nor a valid container entry However in the docs it says It can be called like this [Controller::class, 'some_method'
My code is the following.
use App\Controllers\HomeController;
use DI\Bridge\Slim\Bridge;
use DI\Container;
require 'vendor/autoload.php';
//$container = new Container();
$app = Bridge::create();
$app->addBodyParsingMiddleware();
$app->addRoutingMiddleware();
$app->get('/', [HomeController::class, 'index']);
$app->addErrorMiddleware(true, true, true);
$app->run();
Im using slim v4 and php-di v3
and ofcourse my HomeController has a public method called index. So what could be happening? any ideas? please help <3, thanks!
Hello im having a problem calling the controller class and and a method, basically Slim throws an error sayings
Cannot call index on App\Controllers\HomeController because it is not a class nor a valid container entry
However in the docs it says It can be called like this[Controller::class, 'some_method'
My code is the following.
Im using slim v4 and php-di v3
and ofcourse my HomeController has a public method called index. So what could be happening? any ideas? please help <3, thanks!