Laravel 9 QR Code Generator Example Tutorial

Hello Artisan,

In this laravel qrcode totiroal, I wll explain how to generate qr code in laravel 9 application. For generating qr code, I will use simplesoftwareio/simple-qrcode package to generate qr code in laravel 9.

So from this simplesoftwareiosimple qrcode laravel 9 tutorial, you will learn how to generate qr code using simplesoftwareiosimple qrcode package. In this laravel 9 qr code tutorial, we will learn laravel 9 generate QR code.

Let's see the demo pic of qr code in laravel 9 which we are going to create:

For creating this QR code I am going to use this simplesoftwareio/simple-qrcode package. So let's start our simple qrcode laravel example tutorial from scratch.


Step 1 : Install Laravel 9 Application

I am going from scratch so that you can understand better, So we require to get a Laravel application. So open your terminal and run below command:

composer create-project --prefer-dist laravel/laravel blog


Step 2 :Installing qrcode Generator Package

How to generate QR code in PHP laravel application? to generate it install this package via command line:

composer require simplesoftwareio/simple-qrcode


And paste this below code in the app.php file after installing the simplesoftwareio/simple-qrcode package.


'providers' => [
'aliases' => [
    'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class


Step 3: Create Route

In this step, I will create a route for testing examples. So, let's add a new route to this file.


Route::get('qrcode', function () {
            ->generate('', public_path('images/qrcode.png'));
   return view('qrCode');


Step 4: Create Blade file

Now we are in the final step. We have to create our view file to see the qr code. So let's create it.



Read also: Laravel 9 Generate and Save Barcode Example Tutorial


Hope this laravel 9 QR code tutorial will help you.


#laravel #laravel-9x