Ratings | | Unique User Downloads | | Download Rankings |
Not yet rated by the users | | Total: 273 | | All time: 7,692 This week: 45 |
|
Description | | Author |
This package can generate barcode images in several formats.
It can take several parameters that define the barcode and generates an image file in PNG format that represents the bar code in formats like Code 128, Code 39, Code 2of5, and Codabar.
The class allows to set the text to be converted into a barcode, configure a text to show with the barcode image, the background and foreground colors, the name and path of the file to save the barcode image, the barcode image orientation, the barcode type and size. | |
|
|
Innovation award
Nominee: 2x |
|
Example
<?php
/**
* User: Elminson De Oleo Baez
* Date: 9/15/2018
* Time: 3:01 PM
*/
namespace Elminson\BarCode;
require_once(__DIR__ . '/vendor/autoload.php');
$barcode = new BarCode('code128');
$barcode->setPrint(true);
$barcode->setText("testing");
$barcode->setTextColor("#ff9900");
$barcode->setBgColor("#cccccc");
$barcode->setFileName("test");
$barcode->setFilepath(__DIR__."/temp/");
$barcode->generate();
$barcode->SaveBarcodeToDisk();
$barcode->GetPngData();
$barcode->DrawBarcodeToScreen();
|
Details
BarCode
This script that generates barcodes in four barcode formats including
Code 128, Code 39, Code 2of5, and Codabar. the options of ?vertical? or ?horizontal? display,
varying barcode heights, and one of four barcode formats.
Require
PHP GD Library
Installation
#### Basic use:
namespace Elminson\BarCode;
require_once(__DIR__ . '/vendor/autoload.php');
$barcode = new BarCode('code128');
$barcode->setText("Testing");
$barcode->setPrint(true);
$barcode->setTextColor("#ff9900");
$barcode->setBgColor("#cccccc");
$barcode->setFileName("test");
$barcode->setFilepath(__DIR__."/temp/");
$barcode->generate();
$barcode->SaveBarcodeToDisk();
$bardode->DestroyBarcode();
### Setters
* setText => text to be converte to barcode
* setPrint => Show the text in the barcode
* setBgColor => Set the barcode Background (Default white)
* setTextColor => (Default Black)
* setFileNmae => Name for the image (if empty will generate a random number)
* setFilePath => Path to save the image(if empty will show the image)
* setOrientation => horizontal/vertical
* setCode_type
* setSizeFactor
* setSize => Set text font size
* SaveBarcodeToDisk => Save Barcode
* GetPngData
* DrawBarcodeToScreen
* DestroyBarcode
### Examples
Code128
Code128C
Code128B
Code28A
Code39
Code25
Codabar
php-barcode
Source code for the article "How To Create Barcodes in PHP" found at:
http://davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.