How to Generate BarCode in Laravel?

About Us:

We are from free coder. We are a group of web developers who are passionate about web development. You can learn from us php, laravel, node js, vue js, react js and many other topic on web developement.
we are very happy to help you.
free coder

Today what you are going to learn:


In this tutorial, you will learn laravel barcode generator lesson. We will use how to generate barcode in laravel. you will learn how to save generated bar code in laravel. Here you will learn laravel barcode tutorial. Hello Brother, Creating a basic lesson of picqer/php-barcode-generator laravel php.

You can easily generate barcode in laravel 5, laravel 6, laravel 7 and laravel 8 version.

picqer/php-barcode-generator is a composer package for generate barcode in your laravel 8 application. you can simply generate svg, png, jpg and html image of barcode.

Hello Brother, i write lesson step by step to generate bar code in your laravel admin panel. so let's follow few steps to get this lesson:

Lesson 1: Install Laravel

In first step, If you haven't installed laravel in your system then you can run bellow command and get fresh Laravel project.

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

Lesson 2: Install picqer/php-barcode-generator Package

Now we require to install picqer/php-barcode-generator package for barcode generator, that way we can use it's method. So Open your terminal and run bellow command.

composer require picqer/php-barcode-generator

Lesson 3: Create Route

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



Route::view('barcode', 'barcode');

Lesson 4: Create Blade file

now we need to create barcode.blade.php for display bar code. so let's create blade file as like bellow code:


<!DOCTYPE html>



<title>How to Generate Bar Code in Laravel? -</title>



<h1>How to Generate Bar Code in Laravel? -</h1>

<h3>Product: 0001245259636</h3>


$generator = new Picqer\Barcode\BarcodeGeneratorHTML();


{!! $generator->getBarcode('0001245259636', $generator::TYPE_CODE_128) !!}

<h3>Product 2: 000005263635</h3>


$generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG();


<img src="data:image/png;base64,{{ base64_encode($generatorPNG->getBarcode('000005263635', $generatorPNG::TYPE_CODE_128)) }}">



Now you can run and check it.

thank you very much for following up with me.


Recent Posts

Related Posts