A collection of classes to QR enccode strings and render them as PNG, TIFF and vectorized EPS.
To use the QR Code Suite qrencode
and imagick
have to be available.
{
"require": {
"chroma-x/qr-code-suite": "~2.0"
}
}
require_once('path/to/vendor/autoload.php');
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');
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');
QR Code Suite is under the MIT license.