Laravel qr code generator example tutorial

Hello buddies, How are you? I will show you how to generate QR code in laravel 8. In this article, we will implement a laravel qr code generator. 

Simple-qrcode is a composer package for generate QR code in your laravel 8 application.Simple laravel qr code generator provide to send sms and email with generated QR code. you can create QR code for geo, phoneNumber, birthdate using simple qrcode package.

Create Laravel project

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

Set Database Configuration properties

Go to the .env file and set you Database name, Database username and password.

Read Also: Google Recaptcha V3 Example Tutorial in Laravel 8

Install simple-qrcode Package

Now we require to install simple-qrcode package for generating QR code. Using laravel qr code generator package is the simplest way to generate QR code. So Open your terminal and run bellow command.

composer require simplesoftwareio/simple-qrcode
Official Doc: SimpleSoftwareIO / simple-qrcode by SimplyThomas
Github: SimpleSoftwareIO/simple-qrcode

Now open config/app.php file and add service provider and aliase.


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

Create Route

In this step, we will create one route for testing example. So, let’s add new route on that file.


Route::get('qr-generate', function () {
              ->generate('This is Sample Product Name', public_path('images/qrcode.png'));
    return view('qrCode');

Create Blade file

Now we need to create qrCode.blade.php for display QR code. so let’s create blade file as like bellow code:


<!DOCTYPE html>
    <title>How to Generate QR Code in Laravel 8.0</title>
    <h1>Laravel 8 - QR Code Generator Example</h1>
    {!! QrCode::size(250)->generate('This is Sample Product Name'); !!}

Hope it will helps!