tpay-com/tpay-openapi-php
Composer 安装命令:
composer require tpay-com/tpay-openapi-php
包简介
Tpay OpenAPI library
README 文档
README
Library for all methods available via OpenAPI Tpay.
Polish version 🇵🇱 wersja polska
Installation
Install via Composer:
composer require tpay-com/tpay-openapi-php
Install via Git over SSH:
git clone git@github.com:tpay-com/tpay-openapi-php.git
Install via Git over HTTPS:
git clone https://github.com/tpay-com/tpay-openapi-php.git
Manual download: https://github.com/tpay-com/tpay-openapi-php/archive/master.zip
Configuration
The only thing you need to do is to set your OAuth credentials like in example config file (see example). You can generate access keys in Tpay's merchant panel.
The src/Loader.php file handles all required class loading, so you can include this file to any file you are editing.
All methods described in Tpay OpenAPI documentation can be easily executed by running one of the library methods like:
$cache = new Cache(/** here you can inject your PSR6 or PSR16 cache storage object */); $tpayApi = new TpayApi($cache,'12345-132123', '456'); $transactions = $tpayApi->Transactions->getTransactions();
Credentials
All currently available API methods have an example usage in Examples directory.
You can obtain sandbox credentials by registering on https://register.sandbox.tpay.com/ website.
Examples of usage
Frontend forms and payment handlers:
Payment method choice form, BLIK method form, simple credit card form, extended credit card form, recurrent payment example, payment notification webhook.
Merchant accounts registration (for partners only)
Logs
Library has own logging system to save all API calls, responses, webhook notifications, and exceptions.
Make sure that Logs directory is writable and add rule to Apache .htaccess or NGINX to deny access to this area from browser.
The log files are created for each day separately.
The logging is enabled by default, but you can disable this feature by command:
Logger::disableLogging();
You can also set your own logging path by this command:
Logger::setLogPath('/my/own/path/Logs/');
The logs file names will be assigned automatically.
You can replace the logging system above by setting up your own implementation of Psr\Log\LoggerInterface with:
Logger::setLogger($logger);
Custom templates and static files path
You can set your own templates path, so you can copy and modify the phtml template files from this library.
Util::$customTemplateDirectory = '/my/own/templates/path/';
You can set your own static files path, so you can copy and modify the css and js files from this library. By default, the path is based on $_SERVER['REQUEST_URI'] value.
Util::$libraryPath = '/my/own/path/';
Language
The library supports two languages (English and Polish). Default language is English. Change language example:
// Any time you construct the class providing payment forms, you can pass the language in constructor $paymentForms = new PaymentForms('pl'); // After this line all static messages (input labels, buttons titles etc.) will be displayed in Polish // If you want to access translations manually, use: $lang = new Lang(); $lang->setLang('pl'); // for setting language $lang->lang('pay'); // to echo translated key
License
This library is released under the MIT License.
tpay-com/tpay-openapi-php 适用场景与选型建议
tpay-com/tpay-openapi-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 236.55k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2019 年 08 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tpay-com/tpay-openapi-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tpay-com/tpay-openapi-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 236.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 20
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-13