1
I made an application using Poser with autload, configured the file Composer.js and set the namespace correctly, but when executing the code one of the classes is not found generating the error below.
Fatal Error error: Class 'SON Init Bootstrap' not found in C: xampp htdocs pj App init.php on line 7
Composer.js
{
"name": "son/mvc",
"require":{
"php": ">=7.2"
},
"minimum-stability": "alpha",
"authors": [
{
"name": "Evandro Ignacio",
"email": "[email protected]"
}
],
"autoload": {
"psr-0": {
"SON" : "vendor/",
"App" : ""
}
},
"config": {
"bin-dir":"bin"
}
}
autoload_static.php
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit25747fe376eb11119c2042d9135ae04d
{
public static $prefixesPsr0 = array (
'S' =>
array (
'SON\\' =>
array (
0 => 'C:\\xampp\\htdocs\\pj\\vendor',
),
),
'A' =>
array (
'App\\' =>
array (
0 => __DIR__ . '/../..' . '/',
),
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixesPsr0 = ComposerStaticInit25747fe376eb11119c2042d9135ae04d::$prefixesPsr0;
}, null, ClassLoader::class);
}
}
Calling for
<?php
namespace App;
use SON\Init\Bootstrap;
class Init extends Bootstrap{ // o erro acontece aqui
protected function initRoutes(){
$ar['home'] = array ('route' =>'/','controller'=>'index', 'action'=>'index');
$ar['pedidos'] = array('route' =>'/pedidos', 'controller' => 'index', 'action'=> 'pedidos');
$this->setRoutes($ar);
}
}