I have a project with several subfolders. One of the folders has several add-ons. All of these add-ons have a .json composer and a vendor folder. Now I wanted to create my own addon and create a new folder and put composer.json in this directory. composer install works without problems, but when I somehow install my addon, I get an error
FastCGI: server "/fcgi-bin-php5-fpm-ezi" stderr: PHP message: PHP Fatal error: Call to undefined method Composer\\Autoload\\ClassLoader::setPsr4()
What can cause this problem? I already did composer dump-autoload and composer global update because I found these solutions on the Internet, but it still does not work. Do I have to do something special so that it works in subfolders?
This is currently my composer.json
{ "name": "namespace/projectname-addonname", "autoload": { "psr-4": { "namespace1\\namespace2\\namespace3\\" : "src" } } }
I don't know if this helps, but when I var_dump bootloader, this is the result
object(Composer\Autoload\ClassLoader)#138 (4) { ["prefixes":"Composer\Autoload\ClassLoader":private]=> array(0) { } ["fallbackDirs":"Composer\Autoload\ClassLoader":private]=> array(0) { } ["useIncludePath":"Composer\Autoload\ClassLoader":private]=> bool(false) ["classMap":"Composer\Autoload\ClassLoader":private]=> array(0) { } }
After that, the $loader->setPsr4 method is $loader->setPsr4 , and I get a fatal error.
It is strange that when using classmap instead of psr-4 for startup, it works without problems.
source share