I need help with composer autoloader. Well in my opinion I have set up everything correctly, but still I am having an error "class has been not found".
So maybe someone here will be able to help me. Look at the screenshoots below to understand the way I structured my project and the way I autoloaded namespace for my Test class.
The question is why I am having an error, class has been not found?
You’re
autoload
array is wrong in your composer.json file. If your root namespace isapp
then it should look like this:You can then use your classes in the
app
namespace like this:However, I would camel-case your namespaces, as is the PSR way. So in my case, I have a directory structure like this:
My composer.json file looks like this:
And I can then use my classes like this: