I registered the autoload
on composer.json
"autoload": {
"psr-4": {
"Racioly\MeuPackage\": "src/"
}
}
I created a folder called test
in the project root, and I also created a file teste.php
, this file contains the following code:
require_once __DIR__ . '/../vendor/autoload.php';
use Racioly\MeuPackage\Complex;
var_dump(new Complex(2110));
Within src
I have class Complex
:
namespace Complex;
class Complex {
...
}
But when I run the file through the terminal php teste.php
I get the error:
PHP Fatal error: Uncaught Error: Class 'Racioly \ MyPackage \ Complex' not found in ... test.php: 7
That's exactly where I test the instance of Complex
on var_dump()