Uncaught Error: Class 'Guibranco\BancosBrasileiros\Bank' not found
pferreirafabricio opened this issue · 3 comments
Describe the bug
When trying to use the composer package guibranco/bancos-brasileiros
and the bank schema in examples I get this error:
PHP Fatal error: Uncaught Error: Class 'Guibranco\BancosBrasileiros\Bank' not found in C:\Development\BancosBrasileiros\examples\php\index.php:20
Stack trace:
#0 {main}
thrown in C:\Development\BancosBrasileiros\examples\php\index.php on line 20
To Reproduce
- Run
composer require guibranco/bancos-brasileiros
- Create an index PHP file with the following content:
<?php
require __DIR__ . '/vendor/autoload.php';
use Guibranco\BancosBrasileiros\Bank;
$bank = new Bank();
$bank->COMPE = "123";
echo $bank->COMPE;
- Run it with
php index.php
OBS: I've made an example in my fork of this repository, if it can help in anything here is the link: https://github.com/pferreirafabricio/BancosBrasileiros/tree/main/examples/php
Expected behavior
Reference correctly
Desktop
- OS: Windows 10
- Package Version: 4.0.192
Additional context
I believe that is missing some configurations in the composer.json
of the project and a namespace in php.php
(And I think that in order to autoload work correctly the name of the class has to be the same name as the file). I tried to manually edit the files inside the vendor
folder for testing but don't get anything.
Running the following command composer du -o
, I get this warning:
Generating optimized autoload files
Class Guibranco\BancosBrasileiros\Bank located in C:/Development/BancosBrasileiros/examples/php/vendor/guibranco/bancos-brasileiros/schemas\php.php does not comply with psr-4 autoloading standard. Skipping.
Generated optimized autoload files containing 1 classes
I will pick this one and fix it!
Thanks for the report @pferreirafabricio
Thanks @guibranco!