Git Product home page Git Product logo

promptpay-qr-php's Introduction

PromptPay QR Code Generator - PHP

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

Installation (For CLI)

You can install the package globally via composer:

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

$ 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 farzai/promptpay

Usage

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

use Farzai\PromptPay\PromptPay;
use Farzai\PromptPay\Outputs\FilesystemOutput;

// Generate a QR code for receiving 100 THB from the phone number 0988888888
$imageUri = PromptPay::to('0988888888')
	->amount(100)
	->toDataUri('png');

// Display the QR code
echo '<img src="' . $imageUri . '" />';

Or you can save the QR code to a file:

use Farzai\PromptPay\PromptPay;
use Farzai\PromptPay\Outputs\FilesystemOutput;

$imagePath = PromptPay::to('0988888888')
	->amount(100)
	->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.

promptpay-qr-php's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar imgbotapp avatar parsilver avatar

Stargazers

 avatar  avatar  avatar  avatar

promptpay-qr-php's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.