Help with Page not found not work Slim Exception HttpNotFoundException

I using Slim V4.*, routes working fine but if route not exists not appear Not Found Page, right ?, appear a error:
Type: Error

Code: 0

Message: Class ‘Slim\Middleware\HttpNotFoundException’ not found

File: C:\gleysonabreu\vendor\slim\slim\Slim\Middleware\RoutingMiddleware.php

Line: 91

I’ve searched the solution in several corners but nothing helps.
Does anyone here have a solution?

that does not seems right
there is no such a thing as Slim\Middleware\HttpNotFoundException nor this is throwed in RoutingMiddleware on this line (there is Slim\Exception\HttpNotFoundException )

what version of Slim exactly you are using (by composer.lock file?)

maybe I would suggest delete vendor folder and run composer install again

I’m using version 4.3.0. And I deleted and install again Slim 4.3.0 and not work same error.

how exactly did you deleted and installed slim again?
did you manually erase that folder from vendor ?

this looks like some paths (autoloader) is corrupted

did you install your app using Slim Skeleton or is this custom project?

more information, bootstrap/index php files and files structure would help

This sounds like an issue with a sub-directory (base path). Do you run your slim app in a sub-directory? Slim 4 - HttpNotFoundException - #18 by Quentin


Custom project I using composer.
personal project test:


    require_once 'vendor/autoload.php';

    use Psr\Http\Message\ResponseInterface as Response;

    use Psr\Http\Message\ServerRequestInterface as Request;

    use GA\PageAdmin;

    use GA\DB\Sql;

    use GA\Model\User;

    use Slim\Factory\AppFactory;

    $app = AppFactory::create();

    $app->addErrorMiddleware(true, true, true);

    require 'functions.php';

    require "site.php";

    require 'cpanel.php';



My folder vendor

And my composer.json

"name": "x",
"authors": [
        "name": "xx",
        "email": ""
"require": {
    "slim/slim": "4.3.0",
    "slim/psr7": "^0.6.0",
    "nyholm/psr7": "^1.2",
    "nyholm/psr7-server": "^0.4.1",
    "guzzlehttp/psr7": "^1.6",
    "http-interop/http-factory-guzzle": "^1.0",
    "zendframework/zend-diactoros": "^2.2"
"autoload": {
    "psr-4": {
        "GA\\": "vendor\\gleysonabreu\\php-classes\\src"


@odan not work here your suggestion.

Why do you put your source code into the vendor/ directory?

The project root-directory should look like this:

Directory Content
bin/ command-line executables
config/ configuration files
docs/ documentation files
public/ web server files
resources/ other resource files
src/ PHP source code (the App namespace)
tests/ test code
vendor/ The composer packages (only) and the autoloaders

Read more: Standard PHP package skeleton