承接 ardfar/parse-qris 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ardfar/parse-qris

Composer 安装命令:

composer require ardfar/parse-qris

包简介

A Laravel library for parsing QRIS information from QR code images

README 文档

README

A Laravel library for parsing QRIS (Quick Response Code Indonesian Standard) information from QR code images and strings.

Features

  • ✅ Parse QRIS information from decoded strings
  • ✅ Parse QRIS information directly from QR code images
  • 📊 Extract comprehensive merchant information
  • 💰 Transaction and payment details parsing
  • 🏷️ Support for all standard QRIS tags
  • 📱 Laravel integration with service provider and facade
  • 🔍 Type-safe data structures

Installation

Install via Composer:

composer require ardfar/parse-qris

For Laravel auto-discovery, the service provider will be automatically registered. For manual registration, add to config/app.php:

'providers' => [
    // ...
    Ardfar\ParseQris\QrisServiceProvider::class,
],

'aliases' => [
    // ...
    'QrisParser' => Ardfar\ParseQris\Facades\QrisParser::class,
],

Usage

Using the Facade

use QrisParser;

$qrisString = "00020101021126680016ID.CO.TELKOM.WWW...";
$qrisData = QrisParser::parseFromString($qrisString);

echo "Merchant: " . $qrisData->merchant_name;
echo "City: " . $qrisData->merchant_city;
echo "Currency: " . $qrisData->transaction_currency;

Using the Parser Class Directly

use Ardfar\ParseQris\QrisParser;

$parser = new QrisParser();
$qrisData = $parser->parseFromString($qrisString);

// Access parsed data
echo "Payload Format: " . $qrisData->payload_format_indicator;
echo "Point of Initiation: " . $qrisData->point_of_initiation_method;
echo "Merchant Name: " . $qrisData->merchant_name;
echo "Merchant City: " . $qrisData->merchant_city;
echo "Currency: " . $qrisData->transaction_currency;
echo "Country Code: " . $qrisData->country_code;
echo "MCC: " . $qrisData->mcc;

// Access merchant information
if ($qrisData->merchant_information_26) {
    echo "Global ID: " . $qrisData->merchant_information_26['global_unique_identifier'];
    echo "Merchant PAN: " . $qrisData->merchant_information_26['merchant_pan'];
    echo "Merchant ID: " . $qrisData->merchant_information_26['merchant_id'];
    echo "Criteria: " . $qrisData->merchant_information_26['merchant_criteria'];
}

// Access additional data
if ($qrisData->additional_data) {
    echo "Reference Label: " . $qrisData->additional_data['reference_label'];
    echo "Terminal Label: " . $qrisData->additional_data['terminal_label'];
}

Converting to Array or JSON

$qrisData = QrisParser::parseFromString($qrisString);

// Convert to array
$array = $qrisData->toArray();

// Convert to JSON
$json = $qrisData->toJson();

Parsing from Images

try {
    $qrisData = QrisParser::parseFromImage('/path/to/qr-code-image.jpg');
    
    echo "Merchant: " . $qrisData->merchant_name . "\n";
    echo "City: " . $qrisData->merchant_city . "\n";
    
} catch (QrisParseException $e) {
    echo "Error: " . $e->getMessage();
}

Example Output

Given this QRIS string:

00020101021126680016ID.CO.TELKOM.WWW011893600898026635207502150001952663520750303UMI51440014ID.CO.QRIS.WWW0215ID10211254059720303UMI5204549953033605502015802ID5906BIOLBE6011KAB. MALANG610565168622005091147938120703A03630404CB

The parser will return:

{
    "payload_format_indicator": "01",
    "point_of_initiation_method": "STATIC",
    "merchant_information_26": {
        "global_unique_identifier": "ID.CO.TELKOM.WWW",
        "merchant_pan": "936008980266352075",
        "merchant_id": "000195266352075",
        "merchant_criteria": "UMI"
    },
    "merchant_information_51": {
        "global_unique_identifier": "ID.CO.QRIS.WWW",
        "merchant_id": "ID1021125405972",
        "merchant_criteria": "UMI"
    },
    "mcc": "5499",
    "transaction_currency": "RUPIAH",
    "tip_indicator": "INPUT_TIP",
    "country_code": "ID",
    "merchant_name": "BIOLBE",
    "merchant_city": "KAB. MALANG",
    "merchant_postal_code": "65168",
    "additional_data": {
        "reference_label": "114793812",
        "terminal_label": "A03"
    },
    "crc": "04CB"
}

QRIS Information Glossary

The library extracts the following information from QRIS codes:

  • Merchant Name & Location: Business name, city, and postal code
  • National Merchant ID (NMID): Official merchant registration number
  • Merchant PAN: Acquirer identification number
  • Merchant ID: Internal merchant identifier within PJSP system
  • MCC (Merchant Category Code): Business type classification
  • Transaction Details: Currency, amount, tip information
  • Additional Data: Reference labels, terminal information, etc.

Error Handling

The library throws QrisParseException for various error conditions:

  • Invalid or empty QRIS data
  • Image file not found
  • Invalid image format
  • QR code not found in image
  • QR code reading errors

Requirements

  • PHP 8.0 or higher
  • Laravel 8.0 or higher
  • GD extension (for image processing)

Image QR Code Reading

The library now includes built-in QR code reading functionality using the khanamiryan/qrcode-detector-decoder library. The parseFromImage() method can automatically detect and decode QR codes from image files in the following formats:

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • GIF (.gif)
  • BMP (.bmp)

Usage Example

use Ardfar\ParseQris\QrisParser;
use Ardfar\ParseQris\Exceptions\QrisParseException;

try {
    $parser = new QrisParser();
    $qrisData = $parser->parseFromImage('/path/to/qr-image.jpg');
    
    echo "Merchant: " . $qrisData->merchant_name . "\n";
    echo "Amount: " . $qrisData->transaction_amount . "\n";
    
} catch (QrisParseException $e) {
    echo "Error reading QR code: " . $e->getMessage() . "\n";
}

Testing

The library includes comprehensive tests. Run them with:

vendor/bin/phpunit

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.

Credits

  • Inspired by terryds/qris-decoder
  • Built for the Laravel ecosystem
  • Follows Indonesian QRIS standards

ardfar/parse-qris 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-22