use PHP library in Custom Controller 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.
Did you tried dump-autoload command too -

composer dump-autoload


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