1[![Packagist Downloads](https://img.shields.io/packagist/dt/jucksearm/php-barcode.svg)](https://packagist.org/packages/jucksearm/php-barcode) [![Stable version](https://img.shields.io/packagist/v/jucksearm/php-barcode.svg)](https://packagist.org/packages/jucksearm/php-barcode) [![License](https://img.shields.io/packagist/l/jucksearm/php-barcode.svg)](https://packagist.org/packages/jucksearm/php-barcode)
2
3This is a barcode generation package inspired by [Nicola Asuni](https://github.com/tecnickcom/TCPDF). Actually I use that package's underline classes for generating barcode. This package is just a wrapper of that package and adds compatibility with PHP >= 5.4
4
5I used the following classes of that package.
6
7- lib/Barcode1D.php ([tcpdf_barcodes_1d.php](https://github.com/tecnickcom/TCPDF/blob/master/tcpdf_barcodes_1d.php))
8- lib/Barcode2D.php ([tcpdf_barcodes_2d.php](https://github.com/tecnickcom/TCPDF/blob/master/tcpdf_barcodes_2d.php))
9- lib/QRcode.php ([include/barcodes/qrcode.php](https://github.com/tecnickcom/TCPDF/blob/master/include/barcodes/qrcode.php))
10- lib/Datamatrix.php ([include/barcodes/datamatrix.php](https://github.com/tecnickcom/TCPDF/blob/master/include/barcodes/datamatrix.php))
11- lib/PDF417.php ([include/barcodes/pdf417.php](https://github.com/tecnickcom/TCPDF/blob/master/include/barcodes/pdf417.php))
12
13[Read More on TCPDF website](http://www.tcpdf.org)
14
15## Support
16Barcode generator like QRCode, PDF417, Datamatrix, 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 and SVG.
17
18## This package is compatible with PHP >= 5.4
19
20This package require [php-gd](http://php.net/manual/en/book.image.php) extension. So, make sure it is installed on your machine.
21
22## Installation
23
24Begin by installing this package through Composer. Just run following command to terminal:
25
26```
27composer require jucksearm/php-barcode
28```
29
30You can also edit your project's `composer.json` file to require `jucksearm/php-barcode`.
31
32```
33"require": {
34    ...
35    "jucksearm/php-barcode": "^1.0"
36}
37```
38
39Next, update Composer from the terminal:
40
41```
42composer update
43```
44## How to Use Basic
45```php
46use jucksearm\barcode\Barcode;
47
48Barcode::html('https://github.com/jucksearm/php-barcode', 'C128');
49```
50## How to Use Advance
51```php
52use jucksearm\barcode\Barcode;
53
54Barcode::factory()
55  ->setCode('https://github.com/jucksearm/php-barcode')
56  ->setType('C128')
57  ->setScale(null)
58  ->setHeight(null)
59  ->setRotate(null)
60  ->setColor(null)
61  ->renderHTML();
62```
63[See More Examples](https://github.com/jucksearm/php-barcode/examples)
64
65## Barcode Option
66
67```php
68Barcode::html($code, $type, $scale = null, $height = null, $rotate = null, $color = null)
69
70Barcode::png($code, $type, $file= null, $scale = null, $height = null, $rotate = null, $color = null)
71
72Barcode::svg($code, $type, $file= null, $scale = null, $height = null, $rotate = null, $color = null)
73```
74
75```php
76$type    C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, EAN2, EAN5, EAN8, EAN13, UPCA, UPCE, MSI, MSI+, POSTNET, PLANET, RMS4CC, KIX, IMB, CODABAR, CODE11, PHARMA, PHARMA2T
77$file    Barcode save filename [default: `null`]
78$scale   Barcode unit size in `px` units [default: `1`]
79$height  Barcode height in `px` units [default: `30`]
80$rotate  Support 0, 90 in `degrees` units [default: `0`]
81$color   Support in `hexadecimal` color units [default: `000`]
82```
83
84## QRcode Option
85
86```php
87QRcode::html($code, $emblem = null, $level = null, $size = null, $margin = null, $color = null)
88
89QRcode::png($code, $emblem = null, $file = null, $level = null, $size = null, $margin = null, $color = null)
90
91QRcode::svg($code, $emblem = null, $file = null, $level = null, $size = null, $margin = null, $color = null)
92```
93
94```php
95$emblem  Insert mask Logo [default: `null`]
96$file    QRcode save filename [default: `null`]
97$level   QRcode level L,M,Q,H [default: `L`]
98$size    QRcode width and height size in `px` units [default: `100`]
99$margin  QRcode empty space in `percentage` units [default: `1`]
100$color   Support in `hexadecimal` color units [default: `000`]
101```
102
103## Datamatrix Option
104
105```php
106Datamatrix::html($code, $size = null, $margin = null, $color = null)
107
108Datamatrix::png($code, $file = null, $size = null, $margin = null, $color = null)
109
110Datamatrix::svg($code, $file = null, $size = null, $margin = null, $color = null)
111```
112
113```php
114$file    Datamatrix save filename [default: `null`]
115$size    Datamatrix width and height size in `px` units [default: `100`]
116$margin  Datamatrix empty space in `percentage` units [default: `1`]
117$color   Support in `hexadecimal` color units [default: `000`]
118```
119
120## PDF417 Option
121
122```php
123PDF417::html($code, $size = null, $margin = null, $color = null)
124
125PDF417::png($code, $file = null, $size = null, $margin = null, $color = null)
126
127PDF417::svg($code, $file = null, $size = null, $margin = null, $color = null)
128```
129
130```php
131$file    PDF417 save filename [default: `null`]
132$size    PDF417 width and height size in `px` units [default: `100`]
133$margin  PDF417 empty space in `percentage` units [default: `1`]
134$color   Support in `hexadecimal` color units [default: `000`]
135```
136
137## License
138
139This package is published under `GNU LGPLv3` license and copyright to [Jucksearm Boonmor](https://github.com/jucksearm/php-barcode). Original Barcode generation classes were written by [Nicola Asuni](https://github.com/tecnickcom/barcode). The license agreement is on project's root.
140
141License: GNU LGPLv3
142* **Original Package**      Nicola Asuni https://github.com/tecnickcom/TCPDF
143* **Link**                  http://www.tcpdf.org
144* **Package Copyright**     Jucksearm Boonmor <jucksearm.bkk@gmail.com>