Coder Social home page Coder Social logo

barcode's Introduction

CodeItNow Barcode & QrCode Generator

Barcode and Qr Code generator library by CodeItNow. You can use it with Custom PHP application or any PHP Framework such as Laravel, Symfony, Cakephp, Yii, Codeigneter etc.

Requirements

You must have php >= 5.3.2 installed and GD extension enabled.

Installation -

CodeItNow Barcode & Qr Code Generator can install by composer.

composer require codeitnowin/barcode

Uses -

Barcode and Qr Code Generator library give output as base64 encoded png image.

Example - QrCode:

use CodeItNow\BarcodeBundle\Utils\QrCode;

$qrCode = new QrCode();
$qrCode
    ->setText('QR code by codeitnow.in')
    ->setSize(300)
    ->setPadding(10)
    ->setErrorCorrection('high')
    ->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))
    ->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))
    ->setLabel('Scan Qr Code')
    ->setLabelFontSize(16)
    ->setImageType(QrCode::IMAGE_TYPE_PNG)
;
echo '<img src="data:'.$qrCode->getContentType().';base64,'.$qrCode->generate().'" />';

Sample Image - QrCode:

CodeItNow QrCode Generator

Example - Code128:

use CodeItNow\BarcodeBundle\Utils\BarcodeGenerator;

$barcode = new BarcodeGenerator();
$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code128);
$barcode->setScale(2);
$barcode->setThickness(25);
$barcode->setFontSize(10);
$code = $barcode->generate();

echo '<img src="data:image/png;base64,'.$code.'" />';

Example - Codabar:

$barcode->setText("A0123456789C");
$barcode->setType(BarcodeGenerator::Codabar);

Example - Code11:

$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code11);

Example - Code39:

$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code39);

Example - Code39-Extended:

$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code39Extended);

Example - Ean128:

$barcode->setText("00123456789012345675");
$barcode->setType(BarcodeGenerator::Ean128);

Example - Gs1128:

$barcode->setText("00123456789012345675");
$barcode->setType(BarcodeGenerator::Gs1128);

Example - Gs1128 (with no length limit and unknown identifier):

$barcode->setText("4157707266014651802001012603068039000000006377069620171215");
$barcode->setType(BarcodeGenerator::Gs1128);
$barcode->setNoLengthLimit(true);
$barcode->setAllowsUnknownIdentifier(true);

Example - I25:

$barcode->setText("00123456789012345675");
$barcode->setType(BarcodeGenerator::I25);

Example - Isbn:

$barcode->setText("0012345678901");
$barcode->setType(BarcodeGenerator::Isbn);

Example - Msi:

$barcode->setText("0012345678901");
$barcode->setType(BarcodeGenerator::Msi);

Example - Postnet:

$barcode->setText("01234567890");
$barcode->setType(BarcodeGenerator::Postnet);

Example - S25:

$barcode->setText("012345678901");
$barcode->setType(BarcodeGenerator::S25);

Example - Upca:

$barcode->setText("012345678901");
$barcode->setType(BarcodeGenerator::Upca);

Example - Upca:

$barcode->setText("012345");
$barcode->setType(BarcodeGenerator::Upce);

barcode's People

Watchers

 avatar

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.