kittinan/php-promptpay-qr

PHP Library to generate QR Code payload for PromptPay

0.1.5 2018-02-23 03:58 UTC

This package is auto-updated.

Last update: 2024-11-19 21:32:15 UTC


README

Build Status Code Coverage Scrutinizer Code Quality License: MIT

PHP Library to generate QR Code payload for PromptPay inspired from dtinth/promptpay-qr

Requirement

Composer

This package available on Packagist, Install the latest version with composer

composer require kittinan/php-promptpay-qr

Usage

$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);

Sample Generated PromptPay QR Code

Contributing

Feel free to contribute on this project, I will be happy to work with you.

License

The MIT License (MIT)