I have a custom module and in its controller i am using 'namespace + classname' format to included QRCode library (which is in root/vendor/).

I have used composer to install library

Now I am trying to use this library in custom controller

namespace Drupal\product_display\Controller;
use Endroid\QrCode\QrCode;

But I am getting 'class not found error'

Error: Class 'Endroid\QrCode\QrCode' not found

Class doesn't autoload.

1 Answer 1


Did you tried dump-autoload command too -

composer dump-autoload

Ref: https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.