chroma-x/qr-code-suite

A collection of classes to QR enccode strings and render them as PNG, TIFF and vectorized EPS.

4.0.2 2021-01-18 16:34 UTC

This package is auto-updated.

Last update: 2024-12-19 00:40:11 UTC


README

Code Climate Latest Stable Version Total Downloads License

A collection of classes to QR enccode strings and render them as PNG, TIFF and vectorized EPS.

Requirements

To use the QR Code Suite qrencode and imagick have to be available.

Installation

{
   	"require": {
        "chroma-x/qr-code-suite": "~2.0"
    }
}

Usage

Autoloading and namesapce

require_once('path/to/vendor/autoload.php');

Encoding data as QR code block data

use QrCodeSuite\QrEncode\QrEncoder;

// Encode the data as QR code block data
$encoder = new QrEncoder();
$qrCodeData = $encoder
	->setLevel(QrEncoder::QR_CODE_LEVEL_LOW)
	->setTempDir('path/to/writable/directory')
	->encodeQrCode('https://github.com/chroma-x/php-qr-code-suite');

Render encoded QR code block data as image

use QrCodeSuite\QrRender;

// Render the encoded QR code block data as RGB PNG
$renderer = new QrRender\QrCodeRendererPng();
$renderer->render($qrCodeData, 'path/to/qr-code.png');

// Render the encoded QR code block data as CMYK TIFF
$renderer = new QrRender\QrCodeRendererTiff();
$renderer->render($qrCodeData, 'path/to/qr-code.tif');

// Render the encoded QR code block data as CMYK vectorized EPS
$renderer = new QrRender\QrCodeRendererEps();
$renderer->render($qrCodeData, 'path/to/qr-code.eps');

License

QR Code Suite is under the MIT license.