https://github.com/farzai/promptpay-qr-php
PromptPay QR Code Generator
https://github.com/farzai/promptpay-qr-php
payment promptpay promptpay-qr qrcode
Last synced: 9 days ago
JSON representation
PromptPay QR Code Generator
- Host: GitHub
- URL: https://github.com/farzai/promptpay-qr-php
- Owner: farzai
- License: mit
- Created: 2023-05-24T14:31:24.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-26T14:16:36.000Z (about 1 month ago)
- Last Synced: 2025-04-19T01:21:56.949Z (22 days ago)
- Topics: payment, promptpay, promptpay-qr, qrcode
- Language: PHP
- Homepage:
- Size: 802 KB
- Stars: 7
- Watchers: 0
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# PromptPay QR Code Generator - PHP

[](https://packagist.org/packages/farzai/promptpay)
[](https://github.com/farzai/promptpay-qr-php/actions/workflows/run-tests.yml)
[](https://codecov.io/gh/farzai/promptpay-qr-php)
[](https://packagist.org/packages/farzai/promptpay)This library that allows you to create PromptPay QR codes.
You can generate a QR code for receiving payments through PromptPay, which is a popular payment method in Thailand.## Requirements
- PHP 8.0 or higher
## Installation (For CLI)
You can install the package globally via composer:
```bash
composer global require farzai/promptpay
```
Make sure to place Composer's system-wide vendor bin directory in your $PATH so the promptpay executable can be located by your system.
This directory exists in different locations based on your operating system;
however, some common locations include:For macOS
```
$HOME/.composer/vendor/bin
```For GNU / Linux Distributions
```
GNU / Linux Distributions: $HOME/.config/composer/vendor/bin
```For Windows
```
%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
```## Usage
```bash
$ promptpay
```For example, to generate a QR code for receiving 100 THB from the phone number 0988888888:
```bash
$ promptpay 0988888888 100
```---
## Installation (For PHP Application)
You can install the package via composer:
```bash
composer require farzai/promptpay
```## Usage
For example, to generate a QR code for receiving 100 THB from the phone number 0988888888:
```php
use Farzai\PromptPay\PromptPay;$qrCode = PromptPay::create('0988888888', 100);
$imageUri = $qrCode->toDataUri('png');
echo '
';
```Or you can save the QR code to a file:
```php
use Farzai\PromptPay\PromptPay;$qrCode = PromptPay::create('0988888888', 100):
$imagePath = $qrCode->toFile('qr-code.png');
echo 'QR code saved to ' . $imagePath;
```## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](https://github.com/farzai/.github/blob/main/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [parsilver](https://github.com/parsilver)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.