How to Generate QR Code in Laravel 10 Tutorial

Laravel provides a simplesoftwareio/simple-qrcode composer package for generating QR Code. so we will se the exmple of generating QR code with color, QR code with SMS, QR code with image, QR code with email, and QR code in blade file etc.

Step 1: Install Laravel 10 App

composer create-project laravel/laravel example-QrCode

Step 2: Install Package

composer require simplesoftwareio/simple-qrcode

QR Code Example 1

routes/web.php 

<?php
  
    use Illuminate\Support\Facades\Route;
      
    /*
    |--------------------------------------------------------------------------
    | Web Routes
    |--------------------------------------------------------------------------
    |
    | Here is where you can register web routes for your application. These
    | routes are loaded by the RouteServiceProvider within a group which
    | contains the "web" middleware group. Now create something great!
    |
    */
      
    Route::get('qrcode', function () {
      
         return QrCode::size(300)->generate('A basic example of QR code!');
    });

Run App :

php artisan serv

Add Below Url in Your Browser and see the output:

http://127.0.0.1:8000/qrcode