
In this article I will be explain “how to generate qr code in laravel”, In this article we will implements qr code in laravel 8. if you want to emplement qr code in your application then you are right place. simplesoftwareio/simple-qrcode simple-qrcode is package for generate qr code in laravel application. simple-qrcode provide to send sms and email with generated qr code. you can create qr code for geo, phoneNumber, birthdate using simple qrcode package. For that we require to install simple-qrcode package for qr code generator in application, So we just need to run below command in terminal.
1 2 3 |
composer require simplesoftwareio/simple-qrcode |
After that open config/app.php file and add service provider and aliase.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
'providers' => [ .... SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class ], 'aliases' => [ .... 'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class ], |
Next we need to create route for testing qr-code
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php Route::get('qr-code-test', function () { \QrCode::size(500) ->format('png') ->generate('Webprepration', public_path('images/qrcode.png')); return view('qrCode'); }); |
Now create a blade file to display the qr code, so let’s create blade file as like bellow code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<!DOCTYPE html> <html> <head> <title>How to Generate QR Code in Laravel 8? - webprepration.com</title> </head> <body> <div class="visible-print text-center"> <h1>Laravel 8 - QR Code Generator Example</h1> {!! QrCode::size(250)->generate('webprepration'); !!} <p>example by webprepration.com</p> </div> </body> </html> |
WebpreprationI’m a full-stack developer. My hobby and
read more >>