Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Laravel Barcode Generator

License

NotificationsYou must be signed in to change notification settings

milon/barcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packagist DownloadsStable versionLicense

This is a barcode generation package inspired byhttps://github.com/tecnickcom/TCPDF. Actually, I use that package's underline classes for generating barcodes. This package is just a wrapper of that package and adds compatibility with Laravel.

I used the following classes of that package.

  • src/Milon/Barcode/Datamatrix.php (include/barcodes/datamatrix.php)
  • src/Milon/Barcode/DNS1D.php (tcpdf_barcodes_1d.php)
  • src/Milon/Barcode/DNS2D.php (tcpdf_barcodes_2d.php)
  • src/Milon/Barcode/PDF417.php (include/barcodes/pdf417.php)
  • src/Milon/Barcode/QRcode.php (include/barcodes/qrcode.php)

Read More on TCPDF website

This package relies onphp-gd extension. So, make sure it is installed on your machine.

Installation

Begin by installing this package through Composer. Just run following command to terminal-

composer require milon/barcode

You can also edit your project'scomposer.json file to requiremilon/barcode. Just make sure you choosed the compatible version of the package from the following table.

Compatibility

Laravel VersionBarcode Package Version
12.*^12.0
11.*^11.0
10.*^10.0
9.*^9.0
8.*^8.0
7.*^7.0
6.*^6.0
5.0 and 5.1^5.1
4.0, 4.1, 4.2^4.2

Configuration

If you are using version 6 or above, then the Service Provider and aliases will be published automatically. For prior versions, please follow the below instruction.

After updating Composer, add the service provider to yourconfig/app.php file:

'providers' => [// ...Milon\Barcode\BarcodeServiceProvider::class,]

For Laravel version 4.*, add the following lines to yourapp/config/app.php file:

'providers' =>array(// ...'Milon\Barcode\BarcodeServiceProvider',)

Make sure you have write permission to the storage path. By default it sets to/storage folder.

'aliases' => [// ...'DNS1D' =>Milon\Barcode\Facades\DNS1DFacade::class,'DNS2D' =>Milon\Barcode\Facades\DNS2DFacade::class,]

For version 4.2 alias will be like this-

'aliases' =>array(// ...'DNS1D' =>'Milon\Barcode\Facades\DNS1DFacade','DNS2D' =>'Milon\Barcode\Facades\DNS2DFacade',)

Publishing Configuration

To customize the barcode settings (e.g., store path), publish the configuration file(s) by running the appropriate command in the terminal:

# Laravel 5.xphp artisan vendor:publish# Laravel 4.xphp artisan config:publish milon/barcode

Usage

Bar-code generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

generator in html, png , jpeg embedded base64 code and SVG canvas

echoDNS1D::getBarcodeSVG('4445645656','PHARMA2T');echoDNS1D::getBarcodeHTML('4445645656','PHARMA2T');echo'<img src="data:image/png,' .DNS1D::getBarcodePNG('4','C39+') .'" alt="barcode"   />';echoDNS1D::getBarcodePNGPath('4445645656','PHARMA2T');echo'<img src="data:image/png;base64,' .DNS1D::getBarcodePNG('4','C39+') .'" alt="barcode"   />';echoDNS1D::getBarcodeJPGPath('4445645656','PHARMA2T');echo'<img src="data:image/jpeg;base64,' .DNS1D::getBarcodeJPG('4','C39+') .'" alt="barcode"   />';
echoDNS1D::getBarcodeSVG('4445645656','C39');echoDNS2D::getBarcodeHTML('4445645656','QRCODE');echoDNS2D::getBarcodePNGPath('4445645656','PDF417');echoDNS2D::getBarcodeSVG('4445645656','DATAMATRIX');echo'<img src="data:image/png;base64,' .DNS2D::getBarcodePNG('4','PDF417') .'" alt="barcode"   />';

Width and Height example

echoDNS1D::getBarcodeSVG('4445645656','PHARMA2T',3,33);echoDNS1D::getBarcodeHTML('4445645656','PHARMA2T',3,33);echo'<img src="' .DNS1D::getBarcodePNG('4','C39+',3,33) .'" alt="barcode"   />';echoDNS1D::getBarcodePNGPath('4445645656','PHARMA2T',3,33);echo'<img src="data:image/png;base64,' .DNS1D::getBarcodePNG('4','C39+',3,33) .'" alt="barcode"   />';echoDNS1D::getBarcodeJPGPath('4445645656','PHARMA2T',3,33);echo'<img src="data:image/jpeg;base64,' .DNS1D::getBarcodeJPG('4','C39+',3,33) .'" alt="barcode"   />';

Color

echoDNS1D::getBarcodeSVG('4445645656','PHARMA2T',3,33,'green');echoDNS1D::getBarcodeHTML('4445645656','PHARMA2T',3,33,'green');echo'<img src="' .DNS1D::getBarcodePNG('4','C39+',3,33,array(1,1,1)) .'" alt="barcode"   />';echoDNS1D::getBarcodePNGPath('4445645656','PHARMA2T',3,33,array(255,255,0));echo'<img src="data:image/png;base64,' .DNS1D::getBarcodePNG('4','C39+',3,33,array(1,1,1)) .'" alt="barcode"   />';echoDNS1D::getBarcodeJPGPath('4445645656','PHARMA2T',3,33,array(255,255,0));echo'<img src="data:image/jpeg;base64,' .DNS1D::getBarcodeJPG('4','C39+',3,33,array(1,1,1)) .'" alt="barcode"   />';

Show Text

echoDNS1D::getBarcodeSVG('4445645656','PHARMA2T',3,33,'green',true);echoDNS1D::getBarcodeHTML('4445645656','PHARMA2T',3,33,'green',true);echo'<img src="' .DNS1D::getBarcodePNG('4','C39+',3,33,array(1,1,1),true) .'" alt="barcode"   />';echoDNS1D::getBarcodePNGPath('4445645656','PHARMA2T',3,33,array(255,255,0),true);echo'<img src="data:image/png;base64,' .DNS1D::getBarcodePNG('4','C39+',3,33,array(1,1,1),true) .'" alt="barcode"   />';echoDNS1D::getBarcodeJPGPath('4445645656','PHARMA2T',3,33,array(255,255,0),true);echo'<img src="data:image/jpeg;base64,' .DNS1D::getBarcodeJPG('4','C39+',3,33,array(1,1,1),true) .'" alt="barcode"   />';

2D Barcodes

echoDNS2D::getBarcodeHTML('4445645656','QRCODE');echoDNS2D::getBarcodePNGPath('4445645656','PDF417');echoDNS2D::getBarcodeSVG('4445645656','DATAMATRIX');

1D Barcodes

echoDNS1D::getBarcodeHTML('4445645656','C39');echoDNS1D::getBarcodeHTML('4445645656','C39+');echoDNS1D::getBarcodeHTML('4445645656','C39E');echoDNS1D::getBarcodeHTML('4445645656','C39E+');echoDNS1D::getBarcodeHTML('4445645656','C93');echoDNS1D::getBarcodeHTML('4445645656','S25');echoDNS1D::getBarcodeHTML('4445645656','S25+');echoDNS1D::getBarcodeHTML('4445645656','I25');echoDNS1D::getBarcodeHTML('4445645656','I25+');echoDNS1D::getBarcodeHTML('4445645656','C128');echoDNS1D::getBarcodeHTML('4445645656','C128A');echoDNS1D::getBarcodeHTML('4445645656','C128B');echoDNS1D::getBarcodeHTML('4445645656','C128C');echoDNS1D::getBarcodeHTML('4445645656','GS1-128');echoDNS1D::getBarcodeHTML('44455656','EAN2');echoDNS1D::getBarcodeHTML('4445656','EAN5');echoDNS1D::getBarcodeHTML('4445','EAN8');echoDNS1D::getBarcodeHTML('4445','EAN13');echoDNS1D::getBarcodeHTML('4445645656','UPCA');echoDNS1D::getBarcodeHTML('4445645656','UPCE');echoDNS1D::getBarcodeHTML('4445645656','MSI');echoDNS1D::getBarcodeHTML('4445645656','MSI+');echoDNS1D::getBarcodeHTML('4445645656','POSTNET');echoDNS1D::getBarcodeHTML('4445645656','PLANET');echoDNS1D::getBarcodeHTML('4445645656','RMS4CC');echoDNS1D::getBarcodeHTML('4445645656','KIX');echoDNS1D::getBarcodeHTML('4445645656','IMB');echoDNS1D::getBarcodeHTML('4445645656','CODABAR');echoDNS1D::getBarcodeHTML('4445645656','CODE11');echoDNS1D::getBarcodeHTML('4445645656','PHARMA');echoDNS1D::getBarcodeHTML('4445645656','PHARMA2T');

Running without Laravel

You can use this library without using Laravel.

Example:

use \Milon\Barcode\DNS1D;$d =newDNS1D();$d->setStorPath(__DIR__.'/cache/');echo$d->getBarcodeHTML('9780691147727','EAN13');

License

This package is published underGNU LGPLv3 license and copyright toNuruzzaman Milon. Original Barcode generation classes were written by Nicola Asuni. The license agreement is on project's root.

License: GNU LGPLv3
Package Author:Nuruzzaman Milon
Original Barcode Class Author:Nicola Asuni
Package Copyright: Nuruzzaman Milon
Barcode Generation Class Copyright:
Nicola Asuni
Tecnick.com LTD
www.tecnick.com


[8]ページ先頭

©2009-2025 Movatter.jp