PHP code example of xanderid / qris-dynamicify

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

    

xanderid / qris-dynamicify example snippets




use XanderID\QrisDynamicify\QrisDynamicify;
use XanderID\QrisDynamicify\QrisException;

try {
    $staticQris = "00020101021126590013ID.CO.GOPAY.WWW021500000000000000000303UKE51450014ID.CO.GOPAY.MERCHANT02151234567890123450303UKE5204581253033605802ID5917MERCHANT NATIONAL6011JAKARTA SEL61051215062070703A01";

    $dynamicQris = QrisDynamicify::fromString($staticQris);

    // Set price and tax
    $dynamicQris->setPrice(50000)->setTax("10%");

    // Get the dynamic QRIS string
    echo "Dynamic QRIS String: " . $dynamicQris . PHP_EOL;

    // Save as PNG file
    $dynamicQris->writeToFile("dynamic-qris.png");
    echo "Successfully generated dynamic-qris.png" . PHP_EOL;

} catch (QrisException $e) {
    echo "Error: " . $e->getMessage() . PHP_EOL;
}




use XanderID\QrisDynamicify\QrisDynamicify;
use XanderID\QrisDynamicify\QrisException;

try {
    $dynamicQrisFromFile = QrisDynamicify::fromFile("path/to/static-qris.png");

    // Set price and fixed tax
    $dynamicQrisFromFile->setPrice(125000)->setTax(5000);

    // Save new QRIS file
    $dynamicQrisFromFile->writeToFile("new-dynamic-qris.png");
    echo "Successfully generated new-dynamic-qris.png from file" . PHP_EOL;

} catch (QrisException $e) {
    echo "Error: " . $e->getMessage() . PHP_EOL;
}
bash
   git clone https://github.com/YOUR_USERNAME/qris-dynamicify-php.git