Skip to content

zenepay/promptpay

 
 

Repository files navigation

PromptPay QR Code Generator - PHP

This package forked from farzai/promptpay https://github.com/farzai/promptpay-qr-php This intends to make it upgradeable for Laravel 11 and Laravel 12 that requires dependencies upgrade

Example

Latest Version on Packagist Tests codecov Total Downloads

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

To get latest support for symfony/console: "^7.0" or Laravel 11, Laravel 12

Modify composer to have repositories mapping to zenepay package

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/zenepay/promptpay.git"
        }
    ],
    "minimum-stability": "dev",

Installation (For CLI)

Now You can install the package globally via composer:

composer require zenepay/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

$ promptpay <phone-number> <amount>

For example, to generate a QR code for receiving 100 THB from the phone number 0988888888:

$ promptpay 0988888888 100

Installation (For PHP Application)

You can install the package via composer:

composer require zenepay/promptpay

Usage

For example, to generate a QR code for receiving 100 THB from the phone number 0988888888:

use Farzai\PromptPay\PromptPay;

$qrCode = PromptPay::create('0988888888', 100);

$imageUri = $qrCode->toDataUri('png');

echo '<img src="' . $imageUri . '" />';

Or you can save the QR code to a file:

use Farzai\PromptPay\PromptPay;

$qrCode = PromptPay::create('0988888888', 100):

$imagePath = $qrCode->toFile('qr-code.png');

echo 'QR code saved to ' . $imagePath;

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

PromptPay QR Code Generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%