skip to Main Content
Laravel QR Code Generator

Laravel QR Code generator

Today, we are going to learn Laravel QR Code generator using “milon/barcode” Package. The QR Code is mostly using the enterprise level application. QR Code is the trademark for a type of matrix barcode. A barcode is a machine-readable optical label that contains information about the item to which attach. Let’s see how we can generate Laravel QR Code.

First of all, we are going to install milon/barcode package for QR Code.

I hope you installed the Laravel If not follow this tutorial.

Laravel QR Code Generator

Let’s install the package by the following command to terminal

composer require milon/barcode

Once the installation is complete the next step is to add service provider. Open the config/app.php file, and add a new item to provides array.


Now we are going register Aliases like

'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,

Now the final step is the publish the barcode setting and configuration file by the following command in terminal

php artisan vendor:publish

We are ready for milon/barcode package now let’s see how we can generate Laravel QR Code like

{!! DNS2D::getBarcodeHTML("", "QRCODE") !!}

It generate QR Code for “” like

Laravel QR Code GeneratorWe can also generate QR code with specific Height, Width, Color using parameter options like

QR Code with specific Height and Width

{!! DNS2D::getBarcodeHTML("", "QRCODE", 13, 13, 'blue') !!}

QR Code with specific Color

{!! DNS2D::getBarcodeHTML("", "QRCODE", 13, 13, 'blue') !!}

We can also Generate QR Code as an Image tag like

<div class="content">
    <img src="data:image/png;base64,{{ DNS2D::getBarcodePNG('', 'QRCODE') }}" alt="barcode"   />
    <img src="data:image/png;base64,{{ DNS2D::getBarcodePNG('', 'QRCODE', 13, 13) }}" alt="barcode"   />
    <img src="data:image/png;base64,{{ DNS2D::getBarcodePNG('', 'QRCODE', 13, 13, array(0,255,0)) }}" alt="barcode"   />

It’s too easy to generate Laravel QR Code, Write the comment if you have any question.

If you want to generate QR Code online please follow this QR Code Generator tool.


I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top