tttran / viet_qr_generator
VietQR generator by following vietqr specification
Installs: 13 934
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 2
Forks: 19
Open Issues: 0
Requires
- php: >=7.0
- ext-json: *
- vgplay/qr-code: ^1.0.0
Requires (Dev)
README
Extension to generate Text according to VietQR Specification via account.
Import lib
{ "require":{ "tttran/viet_qr_generator": "v0.6" } }
Examples
##Generate with amount
use tttran\viet_qr_generator\Generator; $gen = Generator()::create() ->bankId("VCB") // BankId, bankname ->accountNo("111111")// Account number ->amount(10000)// Money ->info("toto") // Ref ->generate(); echo $gen; // Print text to generate QR Code
Generate permanently bank transfer
use tttran\viet_qr_generator\Generator; $gen = Generator()::create() ->bankId("VCB") // BankId, bankname ->accountNo("111111")// Account number ->generate(); echo $gen; // Print text to generate QR Code
Generate base64 image
use tttran\viet_qr_generator\Generator; $gen = Generator()::create() ->bankId("VCB") // BankId, bankname ->accountNo("111111")// Account number ->amount(10000)// Money ->info("toto") // Ref ->returnText(false) // if true, return text. If false, return image in base64 ->generate(); $result = json_decode($gen->generate()); // Print text to generate QR Code echo $result->data; // image in base64
Ref:
Functions
Field | Type of parameters | Meaning |
---|---|---|
bankId | String | Bank ID |
accountNo | String | Bank Account |
amount | number with only one dot or not | Amount to transfer. 1000. or 1000 |
info | String | Ref |
returnText | bool | return text if true. Otherwise, return base 64 |
size | integer | size of QR in pixel |
margin | integer | margin of QR |
logoPath | String | Path to logo in the center of image |
isCard | bool | True when bank transfer via card no. False via account no. Default: false |