PHP Phalcon, Loader class doesn't load

Fatal error: Uncaught Error: Class 'Phalcon\Loader' not found in...

I Just installed Phalcon framework and is in phpinfo and also it showed up in the output of php -m command. The other classes such as FactoryDefault, Url are being loaded normally. What could it be?

<?php
use Phalcon\Di\FactoryDefault;
use Phalcon\Loader;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Application;
use Phalcon\Url;

// Define some absolute path constants to aid in locating resources
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');

// Register an autoloader
$loader = new Loader();

$loader->registerDirs(
    [
        APP_PATH . '/controllers/',
        APP_PATH . '/models/',
    ]
);

$loader->register();

$container = new FactoryDefault();

$container->set(
    'view',
    function () {
        $view = new View();
        $view->setViewsDir(APP_PATH . '/views/');
        return $view;
    }
);

$container->set(
    'url',
    function () {
        $url = new Url();
        $url->setBaseUri('/');
        return $url;
    }
);

$application = new Application($container);

try {
    // Handle the request
    $response = $application->handle(
        $_SERVER["REQUEST_URI"]
    );

    $response->send();
} catch (\Exception $e) {
    echo 'Exception: ', $e->getMessage();
}

I tryed Phalcon/Autoload too.

Answer

Solution:

There are many namespace changes in Phalcon 5, one of them is Phalcon\Loader to Phalcon\Autoload\Loader. Full changes list at: https://docs.phalcon.io/5.0/en/upgrade

Source