GithubHelp home page GithubHelp logo

barcodes's Introduction

Latest Stable Version Total Downloads Build Status Coverage Status Scrutinizer Code Quality

Read More Wiki

Barcodes

Generating barcodes in PHP since 2015!

Generates HTML, PNG, or SVG canvas

Supported Barcode Types

One Dimensional

  • Codabar
  • Code 11
  • Code 39 (also extended and/or with check-digit)
  • Code 93
  • Code 128 (A, B, C, or Auto)
  • EAN (2, 5, 13)
  • Intelligent Mail
  • Interleave 2 of 5
  • MSI (also with check-digit)
  • Pharmacode
  • POSTNET (or PLANET)
  • RMS4CC (or KIX)
  • Standard 2 of 5 (also with check-digit)
  • UPC (A, E)

Two Dimensional

  • DataMatrix
  • PDF417
  • QR Code

Requirements

  • Barcodes requires ImageMagick to create PNGs in PHP 5.3.
  • Barcodes requires PHP bcmath extension for Intelligent Mail barcodes

Installation

You can install this package with the Composer CLI:

composer require tklovett/barcodes

Or manually add the dependency to your project's composer.json:

"require": {
    "tklovett/barcodes": "dev-master"
}

And tell composer to install it:

composer install

Usage

First instantiate a BarcodeGenerator factory:

$generator = new BarcodeGenerator();

Then tell it to generate the barcode type of your choice for your code:

$barcode = generator.generate(BarcodeType::QR_CODE, "This is what I want encoded");

Finally, output SVG, HTML, or a PNG:

$svg  = $barcode.toSVG();
$html = $barcode.toHTML();
$png  = $barcode.toPNG();

Need a custom height, width, or color for your barcode? No problem:

$width = 20;
$height = 30;
$color = 'blue';
$sizedSVG  = $barcode.toSVG($width, $height, $color);
$sizedHTML = $barcode.toSVG($width, $height, $color);
$sizedPNG  = $barcode.toSVG($width, $height, $color);

TODO:

  • Convert snake_case method names to camelCase
  • Replace returns from barcode constructors with exception throws
  • Write tests
  • Write docs
  • parent::__construct($code); in all barcodes
  • remove unused methods

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.