Laravel – Barcode generator example using milon/barcode

Laravel – Barcode generator example using milon/barcode

In this post we will give you information about Laravel – Barcode generator example using milon/barcode. Hear we will give you detail about Laravel – Barcode generator example using milon/barcodeAnd how to use it also give you demo for it if it is necessary.

In this post i am going to give you example of how to generate barcode in laravel application. we will create barcode using milon/barcode package that provide several way to generate QR Code and barcode. If you need to generate barcode for your products then you generate barcode sticker in laravel application using milon/barcode package. I added preview of barcode after finish example you can find output like bellow preview. It’s provide several barcode like Qr Code, PDF417, C39,C39+, C39E,C39E+, C93, S25,S25+, I25,I25+ etc. You have to just follow few step:


Step 1: Installation

In first step we will install milon/barcode package for generate bar-code image. so first fire bellow command in your cmd or terminal:

composer require milon/barcode

Now we need to add provider path and alias path in config/app.php file so open that file and add bellow code.


return [


'provides' => [





'aliases' => [



'DNS1D' => MilonBarcodeFacadesDNS1DFacade::class,

'DNS2D' => MilonBarcodeFacadesDNS2DFacade::class,



Step 2: Add Route

In second step we will add new two route for creating small example that way we can undestand very well. so first add bellow route in your routes.php file.


Route::get('barcode', 'HomeController@barcode');

Also see:Laravel – Google reCaptcha Code using anhskohbo/no-captcha

Step 3: Add Controller Method

In this step we will add barcode() method in HomeController Controller file for our example. you can write bellow method on HomeController.

Controller Method

public function barcode()


return view('barcode');


Step 4: Add Blade file

This is a last step and you have to just create new blade file barcode.blade.php and put bellow code on that file.


Also see:Laravel – Google reCaptcha Code using anhskohbo/no-captcha



<style type="text/css">


padding-left: 20px;



<div >

<div >

<h1 style="text-align: center;">Laravel 5 Barcode Generator Using milon/barcode</h1>



<div style="border: 1px solid #a1a1a1;padding: 15px;width: 70%;">

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('11', 'C39')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('12', 'C39+')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('13', 'C39E')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('14', 'C39E+')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('15', 'C93')}}" alt="barcode" />



<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('19', 'S25')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('20', 'S25+')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('21', 'I25')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('22', 'MSI+')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS1D::getBarcodePNG('23', 'POSTNET')}}" alt="barcode" />



<img src="data:image/png;base64,{{DNS2D::getBarcodePNG('16', 'QRCODE')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS2D::getBarcodePNG('17', 'PDF417')}}" alt="barcode" />

<img src="data:image/png;base64,{{DNS2D::getBarcodePNG('18', 'DATAMATRIX')}}" alt="barcode" />



Try this.. if you more learn from here : milon/barcode.

Hope this code and post will helped you for implement Laravel – Barcode generator example using milon/barcode. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

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

71  +    =  73

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US