Error building controller in Slim framework [Callable App \ Controllers \ HomeController does not exist]

0

My application in the slim framework is giving error when trying to build a controller ...

Details
Type: RuntimeException
Message: Callable App\Controllers\HomeController does not exist
File: D:\xampp\htdocs\projetosWeb\base\vendor\slim\slim\Slim\CallableResolver.php
Line: 90

No routes.php is calling the class HomeController ...
which is found in the > app / Controllers / HomeController.php

$app->get('/',"App\Controllers\HomeController:index");

The HomeController is as follows ...

namespace App\Controllers;

use Psr\Log\LoggerInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;

use \Exception;

final class HomeController{

    protected $container;


    protected $request;

    protected $response;

    public function __construct($container){

        $this->container = $container;

    }
    public function index(Request $request, Response $response){
        return 'ok';
    }
}

My composer json is like due in autoload
"autoload" : { "psr-4" : { "App\" : "app" } }

Someone can help me out .. I have tried in several ways using $ container, class and no result: /
if this is help my folder structure

--app > Controllers > HomeController.php
--src > routes.php
    
asked by anonymous 09.06.2018 / 08:09

0 answers