stanley89 / spayd-php
There is no license information available for the latest version (dev-master) of this package.
PHP implementation of SmartPaymentDescriptor Generator.
dev-master
2022-10-31 19:43 UTC
Requires
- ext-iconv: >= 7.0
- endroid/qr-code: >= 2.5
- moneyphp/money: ^3.1
Requires (Dev)
- nette/tester: ^2.0
This package is not auto-updated.
Last update: 2024-05-15 00:36:48 UTC
README
SmartPaymentDescriptor is a lightweight format for exchanging a payment information. A vCard for payment instead of contacts, if you will..
This PHP library simplifies adding the support for generating/validating the SmartPaymentDescriptor (both file and QR code generation) to any PHP application.
Original Java implementation: https://github.com/spayd/spayd-java
Installation
Use Composer to install the library.
$ composer require stanley89/spayd-php
Basic usage
use Spayd\String\SpaydPaymentAttributes; use Spayd\String\SpaydExtendedPaymentAttributeMap; use Spayd\String\SpaydPayment; use Spayd\Model\Account\CzechBankAccount; use Spayd\Utilities\SpaydQRUtils; $parameters = new SpaydPaymentAttributes(); $parameters->setBankAccount(new CzechBankAccount("19", "123", "0800")); $parameters->setAmount("1"); $parameters->setCurrency("CZK"); $parameters->setDate(new \DateTime("2018-12-06")); $parameters->setRecipientName("Jan Novák"); $parameters->setMessage("Příliš žluťoučký kůň úpěl ďábelské ódy."); $extendedParameters = new SpaydExtendedPaymentAttributeMap(["VS" => 123, "SS" => 456, "KS" => 558]); $transliterateParams = true; $result = SpaydPayment::paymentStringFromAccount($parameters, $extendedParameters, $transliterateParams); $qrCode = SpaydQRUtils::getQRCode(null, $result, true); $qrCode->writeFile(__DIR__.'/qrcode.png');
License
The sources are available under Apache 2.0 License