I try to build test project with PatrickLouys/no-framework-tutorial My Controllers/BaseController.php:
<?php
namespace Example\Controllers;
class BaseController
{
public function test(){
echo 'test';
}
}
And index.php file:
<?php
namespace Example;
require __DIR__.'/vendor/autoload.php';
// come code with routes
case \FastRoute\Dispatcher::FOUND:
$className = $routeInfo[1][0];
$method = $routeInfo[1][1];
$vars = $routeInfo[2];
$class = new $className; <-- load the class specified in the routes
$class->$method($vars);
break;
// some code
When I tried run this code I got error:
Class 'Example\Controllers\BaseController' not found
Can you please tell me where I made a mistake?