Download the PHP package farzai/promptpay without Composer
On this page you can find all versions of the php package farzai/promptpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download farzai/promptpay
More information about farzai/promptpay
Files in farzai/promptpay
Package promptpay
Short Description PromptPay QR Code Generator
License MIT
Homepage https://github.com/farzai/promptpay-qr-php
Informations about the package promptpay
PromptPay QR Code Generator - PHP
A modern, type-safe PHP library for generating PromptPay QR codes.
Features
- Zero Config - Works out of the box with sensible defaults
- Multiple Formats - PNG, SVG, GIF support
- Amount Support - Static or dynamic QR codes
- CLI Tool - Command-line interface included
Requirements
- PHP 8.1 or higher
- Composer
Installation
For PHP Applications
For CLI Usage (Global)
Make sure Composer's global bin directory is in your $PATH:
- macOS/Linux:
~/.composer/vendor/binor~/.config/composer/vendor/bin - Windows:
%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
Quick Start
Simple Example
Modern Builder API (Recommended)
Usage Guide
Creating QR Codes
Static QR Code (No Amount)
Dynamic QR Code (With Amount)
Recipient Types
The library automatically detects recipient type based on length:
Output Formats
1. Data URI (for <img> tags)
2. Save to File
3. PSR-7 HTTP Response
First, install any PSR-17/PSR-7 implementation:
Then create the response:
With Guzzle PSR-7:
Why PSR-17? No hard dependencies! Works with ANY PSR-7 library - choose the one your project already uses.
4. Console Output (CLI)
5. Raw Payload String
Advanced Configuration
Immutable Builder Pattern
The builder is fully immutable - each method returns a new instance:
Validation & Error Handling
The library provides comprehensive validation with helpful error messages:
Recipient Validation
Amount Validation
Error Codes Reference
Recipient Errors (1xxx)
1001- Empty recipient1002- Not numeric1003- Invalid length1004- Empty after normalization
Amount Errors (2xxx)
2001- Not numeric2002- Negative amount2003- Too large (> 999,999,999.99)2004- Zero (when positive required)2005- Too small (< 0.01)
Configuration Errors (3xxx)
3001- Size too small3002- Size too large3003- Margin too small3004- Margin too large3005- Invalid encoding3006- Invalid path3007- Missing dependency
CLI Usage
Testing
Examples
Check the examples/ directory for real-world usage scenarios:
- 01-basic-usage.php - Basic QR code generation and builder patterns
- 02-file-generation.php - Saving to files with custom configurations
- 03-error-handling.php - Comprehensive error handling patterns
- 04-web-integration.php - Web form integration with HTML
- 05-laravel-integration.php - Laravel framework integration
- 06-symfony-integration.php - Symfony framework integration
- 07-custom-validation.php - Custom validation patterns and business rules
- 08-batch-generation.php - Batch processing and bulk generation
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Security
If you discover any security vulnerabilities, please review our security policy on how to report them.
Changelog
Please see CHANGELOG.md for recent changes.
License
The MIT License (MIT). Please see LICENSE.md for more information.
Credits
- parsilver
- All Contributors
Acknowledgments
- Built with endroid/qr-code
- Follows PromptPay EMV QR Code Specification
- Inspired by Thailand's National e-Payment Master Plan
Made with ❤️ for the Thai developer community
All versions of promptpay with dependencies
endroid/qr-code Version ^5.0.0 <5.1
symfony/console Version ^6.0|^7.0|^8.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0|^2.0