how to Generate Barcode in laravel 8

in this blogpost, I wil give generate barcode in laravel php, hello and you use this code step by step follow by as my handled and get the output as run done.

picqer/php-barcode-generator is a composer package for generate barcode.

Here i will use and admin panel show code and listing view this.

how to generate barcode in laravel, Barcode Generator in laravel

Step 1: Install Laravel Project how to generate barcode in laravel

in this first step i will use only this command and create new project.

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

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

Now we are run this command:

composer require picqer/php-barcode-generator

Step 3: Create Route : how to Generate Barcode in laravel

web.php

<?php


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

Step 4: Create Blade file

resources/views/index.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>How to Generate Bar Code in Laravel? - Laratuto.com</title>
</head>
<body>
  
<h1>How to Generate Barcode in Laravel? - Laratuto.com</h1>
   
<h3>Item : 77898751CASDD</h3>
@php
    $data = new Picqer\Barcode\BarcodeGeneratorHTML();
@endphp
  
{!! $data->getBarcode('0001245259636', $data::TYPE_CODE_128) !!}
  
  
<h3>Item 2: 859ADREFFFD</h3>
@php
    $DataPNG = new Picqer\Barcode\BarcodeGeneratorPNG();
@endphp
  
<img src="data:image/png;base64,{{ base64_encode($DataPNG->getBarcode('77898751CASDD', $DataPNG::TYPE_CODE_128)) }}">
</body>
</html>

Now run your project…

1 thought on “how to Generate Barcode in laravel 8”

Leave a Comment