khalilleo-webagentur / php-qrcode
PHP library for QR-Code generation
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^8.1
README
PHP library for QR Code Generator.
Requirements
- PHP
^8.1
Installation
composer require khalilleo-webagentur/php-qrcode
Usage
// sample HTML <?php require 'vendor/autoload.php'; use Khalilleo\QrCode\QrCode; use Khalilleo\QrCode\QrHelper; $qr = new QRCode(); // QrHelper::QR_ERROR_CORRECT_LEVEL_L (7%) // QrHelper::QR_ERROR_CORRECT_LEVEL_M : (15%) // QrHelper::QR_ERROR_CORRECT_LEVEL_Q : (25%) // QrHelper::QR_ERROR_CORRECT_LEVEL_H : (30%) $qr->setErrorCorrectLevel(QrHelper::QR_ERROR_CORRECT_LEVEL_L); $qr->setTypeNumber(4); $anyString = "https://www.khalilleo.com"; $qr->addData($anyString); $qr->make(); $qr->printHTML(); echo "<br><br>"; $qr = QrCode::getMinimumQRCode($anyString, QrHelper::QR_ERROR_CORRECT_LEVEL_L); $qr->printHTML();
// sample image <?php use Khalilleo\QrCode\QrCode; use Khalilleo\QrCode\QrHelper; require 'vendor/autoload.php'; $qr = QrCode::getMinimumQRCode("https://www.khalilleo.com", QrHelper::QR_ERROR_CORRECT_LEVEL_L); $im = $qr->createImage(2, 4); header("Content-type: image/gif"); imagegif($im); imagedestroy($im);
<?php // sample XML require 'vendor/autoload.php'; use Khalilleo\QrCode\QrCode; use Khalilleo\QrCode\QrHelper; $qr = QrCode::getMinimumQRCode("https://www.khalilleo.com", QrHelper::QR_ERROR_CORRECT_LEVEL_L); header("Content-type: text/xml"); print("<qrcode>"); for ($r = 0; $r < $qr->getModuleCount(); $r++) { print("<line>"); for ($c = 0; $c < $qr->getModuleCount(); $c++) { print($qr->isDark($r, $c)? "1" : "0"); } print("</line>"); } print("</qrcode>");
Credit
Copyright
This project is licensed under the MIT License.