BarCode
Overview #
The Barcode
package allows you to create various type of barcodes and qrcodes in multiple format like jpg, png and svg.
Installation #
By downloading .zip file #
- Download zip file from My Licenses
- Unzip
- Copy the folder
barcode
intokoolreport
folder, it will look like below:
koolreport
├── core
├── barcode
By composer #
If you have purchased the package then you can follow these steps to install
- Login to koolreport.com
- Go to My Licenses
- Click Get Token For Composer button
- Copy the text and save to file
auth.json
next tocomposer.json
- Add the repositories to
composer.json
like below - Run
composer update
to install package
composer.json
{
"repositories":[
{"type":"composer","url":"https://repo.koolreport.com"}
],
"require":{
"koolreport/barcode":"*",
...
}
}
Your auth.json
will look like this:
{
"http-basic": {
"repo.koolreport.com": {
"username": "your@email.com",
"password": "your-secret-token"
}
}
}
Note: Please add your auth.json
to .gitignore
as it contains your secret login information.
Quickstart #
In your view, you could use the BarCode
and QRCode
widgets like following:
<?php
//MyReport.view.php
use \koolreport\barcode\BarCode;
use \koolreport\barcode\QRCode;
?>
...
<?php
BarCode::create(array(
"format" => "html", //"svg", "png", "jpg"
"value" => "081231723897",
"type" => "TYPE_CODE_128",
"widthFactor" => 2,
"height" => 30,
"color" => "black", //"{{color string}}" for html and svg, array(R, G, B) for jpg and png
));
?>
...
<?php
QRCode::create(array(
"format" => "svg", //"png", "jpg"
"value" => "Test QRCode",
"size" => 150,
"foregroundColor" => array(0, 0, 0),
"backgroundColor" => array(255, 255, 255),
));
?>
BarCode #
Properties #
name | type | default | description |
---|---|---|---|
format | string | "jpg" | This property defines the output format of barcodes. We have 4 formats: html (using divs and background color), svg (vector image), jpg and png. |
value | string | "" | This is the value of barcode |
type | string | "TYPE_CODE_128" | This property is for various types of barcode. List of support barcode type is below. |
widthFactor | number | "2px" | This is the width of each bar in pixel |
height | number | 30 | This set the height of barcodes. |
color | string/array | A color string for html and svg formats; an array of (r, g, b) values for jpg and png formats. |
List of types #
Supported types of BarCodes | ||
---|---|---|
TYPE_CODE_39 | TYPE_CODE_39_CHECKSUM | TYPE_CODE_39_CHECKSUM |
TYPE_CODE_39E | TYPE_CODE_39E_CHECKSUM | TYPE_CODE_93 |
TYPE_STANDARD_2_5 | TYPE_STANDARD_2_5_CHECKSUM | TYPE_INTERLEAVED_2_5 |
TYPE_INTERLEAVED_2_5_CHECKSUM | TYPE_CODE_128 | TYPE_CODE_128_A |
TYPE_CODE_128_B | TYPE_CODE_128_C | TYPE_EAN_2 |
TYPE_EAN_5 | TYPE_EAN_8 | TYPE_EAN_13 |
TYPE_UPC_A | TYPE_UPC_E | TYPE_MSI |
TYPE_MSI_CHECKSUM | TYPE_POSTNET | TYPE_PLANET |
TYPE_RMS4CC | TYPE_KIX | TYPE_IMB |
TYPE_CODABAR | TYPE_CODE_11 | TYPE_PHARMA_CODE |
TYPE_PHARMA_CODE_TWO_TRACKS |
QRCode #
Properties #
name | type | default | description |
---|---|---|---|
format | string | "jpg" | This property defines the output format of qrcodes. We have 3 formats: svg, jpg and png. |
value | string | "" | This is the value of qrcode. |
size | number | 150 | Set the size in px of qrcodes. |
foregroundColor | array | array(0,0,0) | An array of (r, g, b) values for the foreground color of qrcodes. |
backgroundColor | array | array(255, 255, 255) | An array of (r, g, b) values for the background color of qrcodes. |
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.