mpdf / qrcode
QR code generator for mPDF
Fund package maintenance!
www.paypal.me/mpdf
Installs: 1 718 322
Dependents: 41
Suggesters: 0
Security: 0
Stars: 45
Watchers: 5
Forks: 13
Open Issues: 2
Language:HTML
Requires
- php: ^5.6 || ^7.0 || ^8.0
- paragonie/random_compat: ^1.4|^2.0|^9.99.99
Requires (Dev)
- mockery/mockery: ^0.9.5
- squizlabs/php_codesniffer: ^3.4
- tracy/tracy: ^2.5
- yoast/phpunit-polyfills: ^1.0
Suggests
- ext-gd: To output QR codes to PNG files
- ext-simplexml: To output QR codes to SVG files
This package is auto-updated.
Last update: 2024-11-02 15:39:09 UTC
README
QR code generating library with HTML/PNG/mPDF output possibilities.
This is based on QrCode library bundled with mPDF until v8.0, made by Laurent Minguet. It is provided under LGPL license.
Installation
$ composer require mpdf/qrcode
Usage
<?php use Mpdf\QrCode\QrCode; use Mpdf\QrCode\Output; $qrCode = new QrCode('Lorem ipsum sit dolor'); // Save black on white PNG image 100 px wide to filename.png. Colors are RGB arrays. $output = new Output\Png(); $data = $output->output($qrCode, 100, [255, 255, 255], [0, 0, 0]); file_put_contents('filename.png', $data); // Echo a SVG file, 100 px wide, black on white. // Colors can be specified in SVG-compatible formats $output = new Output\Svg(); echo $output->output($qrCode, 100, 'white', 'black'); // Echo an HTML table $output = new Output\Html(); echo $output->output($qrCode);