Answer the question
In order to leave comments, you need to log in
What should I do to make composer load library files?
I'm trying to figure out the composer's autoloader. I re-read psr-4 psr-0 several times already, the file structure after installation (by composer) looks like this:
/vendor/machetero/PackageName/Client/Producer.php - this file contains the class \PackageName\Client\Producer
/vendor/ machetero/PackageName/Client/Consumer.php - this file contains the class \PackageName\Client\Consumer
and so on.
I connect /vendor/autoload.php
I try to create objects:
$producer = \PackageName\Client\Producer();
$consumer = \PackageName\Client\Consumer();
resulting in an error class not found.
What am I doing wrong ?
Answer the question
In order to leave comments, you need to log in
You need to have an autoload section in composer.json:
"autoload": {
"psr-4": {
"PackageName\\": ""
}
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question