PHP code example of kittinan / php-promptpay-qr
1. Go to this page and download the library: Download kittinan/php-promptpay-qr library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kittinan / php-promptpay-qr example snippets
$pp = new \KS\PromptPay();
//Generate PromptPay Payload
$target = '0899999999';
echo $pp->generatePayload($target);
//00020101021129370016A000000677010111011300668999999995802TH53037646304FE29
//Generate PromptPay Payload With Amount
$target = '089-999-9999';
$amount = 420;
echo $pp->generatePayload($target, $amount);
//00020101021229370016A000000677010111011300668999999995802TH53037645406420.006304CF9E
//Generate QR Code PNG file
$target = '1-2345-67890-12-3';
$savePath = '/tmp/qrcode.png';
$pp->generateQrCode($savePath, $target);
//Generate QR Code With Amount
$amount = 420;
$pp->generateQrCode($savePath, $target, $amount);
//Set QR Code Size Pixel
$width = 1000;
$pp->generateQrCode($savePath, $target, $amount, $width);
composer