PHP Classes

PHP Barcode Generator Save Image: Generate barcode images in several formats

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 273 All time: 7,691 This week: 45Up
Version License PHP version Categories
barcodegenerator 1.0.0GNU General Publi...5PHP 5, Graphics
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.

Picture of Elminson De Oleo
  Performance   Level  
Name: Elminson De Oleo <contact>
Classes: 5 packages by
Country: United States United States
Age: 44
All time rank: 2412329 in United States United States
Week rank: 227 Up23 in United States United States Up
Innovation award
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
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/


  Files folder image Files (24)  
File Role Description
Files folder image.idea (7 files, 1 directory)
Files folder imagesrc (2 files)
Files folder imagetemp (7 files)
Files folder imagetests (1 file)
Accessible without login Plain text file barcode.php Aux. Auxiliary script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (24)  /  .idea  
File Role Description
Files folder imagecodeStyles (1 file)
  Accessible without login Plain text file misc.xml Data Auxiliary data
  Accessible without login Plain text file modules.xml Data Auxiliary data
  Accessible without login Plain text file php-barcode.iml Data Auxiliary data
  Accessible without login Plain text file php-test-framework.xml Data Auxiliary data
  Accessible without login Plain text file php.xml Data Auxiliary data
  Accessible without login Plain text file vcs.xml Data Auxiliary data
  Accessible without login Plain text file workspace.xml Data Auxiliary data

  Files folder image Files (24)  /  .idea  /  codeStyles  
File Role Description
  Accessible without login Plain text file codeStyleConfig.xml Data Auxiliary data

  Files folder image Files (24)  /  src  
File Role Description
  Plain text file BarCode.php Class Class source
  Plain text file ConfigCode.php Class Class source

  Files folder image Files (24)  /  temp  
File Role Description
  Accessible without login Image file codabar.png Icon Icon image
  Accessible without login Image file code128.png Icon Icon image
  Accessible without login Image file code128a.png Icon Icon image
  Accessible without login Image file code128b.png Icon Icon image
  Accessible without login Image file code128c.png Icon Icon image
  Accessible without login Image file code25.png Icon Icon image
  Accessible without login Image file code39.png Icon Icon image

  Files folder image Files (24)  /  tests  
File Role Description
  Plain text file TestBarCode.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:273
This week:0
All time:7,691
This week:45Up