Uncaught RuntimeException: does not exist in CallableResolver.php:152

What could be causing this error? Thank you

Fatal error: Uncaught RuntimeException: Callable App\Controllers\CitasController::getAll() does not exist in C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\CallableResolver.php:152 Stack trace: #0 C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\CallableResolver.php(103): Slim\CallableResolver->resolveSlimNotation(‘App\Controllers…’) #1 C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\CallableResolver.php(72): Slim\CallableResolver->resolveByPredicate(‘App\Controllers…’, Array, ‘handle’) #2 C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\Routing\Route.php(366): Slim\CallableResolver->resolveRoute(‘App\Controllers…’) #3 C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\MiddlewareDispatcher.php(81): Slim\Routing\Route->handle(Object(Slim\Psr7\Request)) #4 C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\MiddlewareDispatcher.php(81): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request)) #5 C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\Routing\Route.php(341): Slim\MiddlewareDispatcher->handle(Objec in C:\xampp\htdocs\servidorapi\vendor\slim\slim\Slim\CallableResolver.php on line 152

Annex structure and code that I have made:


In the main .htaccess file:

RewriteEngine on
RewriteBase /servidorapi/public/
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]

In the .htaccess file that is inside public:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

In the index.php file:


require __DIR__ . '/../src/App/App.php';

In the app.php file:


use Slim\Factory\AppFactory;

require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../src/config/db.php';

$app = AppFactory::create();

require __DIR__ . '/Routes.php';


in the Routes.php:


//ayuda a definir las rutas en grupos
use Slim\Routing\RouteCollectorProxy;

//definen grupo de rutas
$app->group('/api',function(RouteCollectorProxy $group){



In the CitasController.php:

<?php namespace App\Controllers;

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

class CitasController{

    public function getAll($request,$response,$arg){
            $response->getBody()->write("Hello, Word!");
            return $response;


In the composer.json:

    "require": {
        "slim/slim": "4.*",
        "slim/psr7": "^1.5",
        "php-di/php-di": "^6.3"
            "App\\" : "src/"

I guess it is the composer autoload entry for the App namespace in combination with the directory structure, because you have an additional subdirectory src/App which is not needed. The src/ directory should contain only PHP classes and no config files.

So you have two options to solve it. 1. Keep the autoload entry and move/remove src/App to src/ or option 2. change to autoloader to "App\\" : "src/App/" (not recommended)

Thank you very much I will proceed with option one as you comment, greetings.