定制 xanderid/qris-dynamicify 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xanderid/qris-dynamicify

Composer 安装命令:

composer require xanderid/qris-dynamicify

包简介

Transform static QRIS into dynamic QRIS effortlessly. Designed for modern payment integrations in Indonesia.

README 文档

README

qris-dynamicify is a powerful and lightweight composer library for effortlessly transforming static QRIS (Quick Response Code Indonesian Standard) into dynamic QRIS. This tool is designed for developers and businesses in Indonesia who need to generate transaction-specific QR codes with dynamic amounts, streamlining the payment process for modern applications.

The project solves the problem of static, non-specific QRIS codes by allowing you to programmatically inject transaction details like price and taxes, making the payment experience seamless for both merchants and customers.

Key Features

  • Static to Dynamic Conversion: Convert any valid static QRIS string or image into a dynamic one.
  • Set Transaction Amount: Easily set a specific price for the transaction.
  • Add Tax/Service Fee: Include nominal or percentage-based taxes and fees.
  • QRIS Metadata Extraction: Parse and retrieve merchant information from any QRIS code.
  • Multiple Input Formats: Accepts QRIS data from a raw string or an image file (.png, .jpg, .jpeg).
  • Flexible Output: Generate a dynamic QRIS as a raw string or save it directly as a QR code image.
  • PHP-Friendly: Fully written in PHP with type-safe methods for a clean development experience.
  • Lightweight: Minimal dependencies to keep your project lean.

Installation

You can install qris-dynamicify via composer.

composer require xanderid/qris-dynamicify

Live Demo

You can try QRIS Dynamicify directly in your browser:

https://xanderid.github.io/qris-dynamicify/

Usage Instructions

Here’s how to get started with qris-dynamicify.

Basic Example: From a Static QRIS String

require_once 'vendor/autoload.php';

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;
}

Example: From a QRIS Image File

require_once 'vendor/autoload.php';

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;
}

API Documentation

The main entry points are fromString and fromFile, which return a QrisDynamicify instance.

fromString(string $staticQris): QrisDynamicify

  • Description: Creates a QrisDynamicify instance from a static QRIS string.
  • Parameters:
    • $staticQris (string): The raw static QRIS data.
  • Returns: A QrisDynamicify instance.
  • Throws: QrisException if the string is empty.

fromFile(string $filePath): QrisDynamicify

  • Description: Creates a QrisDynamicify instance from an image file containing a static QRIS.
  • Parameters:
    • $filePath (string): Path to the QRIS image file (.png, .jpg, .jpeg).
  • Returns: A QrisDynamicify instance.
  • Throws: QrisException if the file cannot be read or is invalid.

QrisDynamicify Methods

setPrice(int $price): self

  • Description: Sets the transaction amount.
  • Parameters:
    • $price (int): The amount in your currency (e.g., IDR). Must be ≥ 0.
  • Returns: The same QrisDynamicify instance for method chaining.
  • Throws: QrisException if the price is negative.

setTax(int|string $tax): self

  • Description: Sets the tax or service fee. Can accept a fixed number or a percentage string.
  • Parameters:
    • $tax (int|string): Tax amount. Examples:
      • Fixed nominal: 5000
      • Percentage: "10%"
  • Returns: The same QrisDynamicify instance for method chaining.
  • Throws: QrisException if the value is negative or format is invalid.

getMetadata(): QrisMetadata

  • Description: Extracts and returns metadata from the QRIS code.
  • Returns: A QrisMetadata object containing the following getter methods:

QrisMetadata Getters

Method Description
getMerchant(): string Returns the merchant name.
getCompany(): string Returns the company or organization name.
getRegion(): string Returns the region or province.
getCountry(): string Returns the country code (ISO).
getPostalCode(): string Returns the postal/ZIP code.
getMerchantPan(): string Returns the merchant PAN (Primary Account Number).
getPrice(): ?string Returns the transaction price, if available.
getTax(): ?string Returns the tax amount, if available.
toArray(): array<string, ?string> Returns all metadata as an associative array.
  • Throws: QrisException if parsing fails.

writeToFile(string $filePath, ?QROptions $options = null): string

  • Description: Saves the current dynamic QRIS to a file.
  • Parameters:
    • $filePath (string): Destination path. Supports .png, .jpg, .jpeg, .txt.
    • $options (QROptions|null): Optional QR code generation settings (size, error correction).
  • Returns: The saved file path.
  • Throws: QrisException if the file extension is unsupported.

__toString(): string

  • Description: Returns the raw dynamic QRIS string.
  • Returns: The dynamic QRIS string.

Contribution Guide

We welcome contributions! Please follow these steps:

  1. Fork the repository: Click the 'Fork' button at the top right of this page.

  2. Clone your fork:

    git clone https://github.com/YOUR_USERNAME/qris-dynamicify-php.git
  3. Create a new branch:

    git checkout -b feature/your-feature-name
  4. Make your changes: Implement your feature or fix the bug.

  5. Commit your changes:

    git commit -m "feat: Add some amazing feature"
  6. Push to your branch:

    git push origin feature/your-feature-name
  7. Create a Pull Request: Open a pull request from your fork to the main repository.

Roadmap

  • CLI tool for quick conversions from the terminal.
  • Add more examples and detailed documentation.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credits

This project relies on the following open-source libraries:

FAQ

Q: What is the difference between static and dynamic QRIS? A: A static QRIS contains only the merchant's information. The customer has to manually input the transaction amount. A dynamic QRIS is generated for a single transaction and includes the amount, making the payment process faster and less error-prone.

Q: Can I use this for any QRIS code from any provider? A: Yes, this library should work with any valid QRIS code that complies with the Bank Indonesia standard.

Why this project?

In the rapidly growing digital economy of Indonesia, QRIS has become a ubiquitous payment method. However, many smaller businesses still rely on static QRIS displays, which require manual entry of payment amounts. This can be slow and prone to errors. qris-dynamicify was created to bridge this gap, providing developers with a simple, powerful tool to integrate dynamic QRIS generation into their applications. Whether you're building a POS system, an e-commerce platform, or a donation portal, this library helps you create a smoother, more professional payment experience.

xanderid/qris-dynamicify 适用场景与选型建议

xanderid/qris-dynamicify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 39 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment」 「qr-code」 「QR-Payment」 「qris」 「qris-dynamic」 「qris-static」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 xanderid/qris-dynamicify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 xanderid/qris-dynamicify 我们能提供哪些服务?
定制开发 / 二次开发

基于 xanderid/qris-dynamicify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 39
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-09-28