PHP code example of tttran / viet_qr_generator

1. Go to this page and download the library: Download tttran/viet_qr_generator 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/ */

    

tttran / viet_qr_generator example snippets


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

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

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