Skip to content

This library that generates barcodes in four barcode formats including Code 128, Code 39, Code 2of5, and Codabar.

License

Notifications You must be signed in to change notification settings

elminson/barcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

composer require elminson/barcode

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 Codabar

Code128C Codabar

Code128B Codabar

Code28A Codabar

Code39 Codabar

Code25 Codabar

Codabar 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/

About

This library that generates barcodes in four barcode formats including Code 128, Code 39, Code 2of5, and Codabar.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages