Search code examples
phplaravelqr-code

i can use phpqrcode libraby in laravel ? https://sourceforge.net/projects/phpqrcode/


i try to use phpqrcode library in laravel project this package is very popular , this is her link https://sourceforge.net/projects/phpqrcode/ i use class qrCode in controller but i got this error message : "Class "QRcode" not found" error when i use phpqrcode class in laravel framework

this is my controller

public function store(Request $request)
    {
       $input =  $request->all();
       // include(app_path().'/phpqrcode/qrlib.php');
        $code = $request->email ;
        $filename ='test' . md5($code) . '.png';
        QRcode::png($code, \public_path("temp/$filename"));
        $input['qr_code']= $filename;
        Participant::create($input);
        return response()->json(['status'=>'success','message'=>'participant saved succefully !' ],201);

    }

Solution

  • How did you proceed with the installation of the lib into your project?

    The lib documentation has some steps that you should follow in order to get started.Please check on the INSTALL FILE.

    screenshot from the lib install file

    Personally, I would recommend you use a dependency installed from composer.

    Some popular ones can be found at packagist. Try out this as it is well documented