可能是我用过的最优雅的 Alipay 和 WeChat 的支付 SDK 扩展包了
This package's canonical repository appears to be gone and the package has been frozen as a result.
v0.0.2
2022-01-15 13:19 UTC
Requires
- php: >=7.3
- ext-bcmath: *
- ext-json: *
- ext-libxml: *
- ext-openssl: *
- ext-simplexml: *
- psr/container: ^1.1 | ^2.0
- psr/event-dispatcher: ^1.0
- psr/http-client: ^1.0
- psr/http-message: ^1.0
- psr/log: ^1.0.1 || ^2.0 || ^3.0
- yansongda/supports: ~3.1.0
Requires (Dev)
This package is not auto-updated.
Last update: 2024-08-12 00:07:29 UTC
README
基于 https://github.com/yansongda/pay 修改支持hyperf框架,版权归属 https://github.com/yansongda/pay 所有
安装
composer require yansongda-hyperf/pay php bin/hyperf.php vendor:publish yansongda-hyperf/pay
使用
use Yansongda\Pay\Pay; // 使用注解定义 /** * @Inject * @var Pay */ protected $pay; // 通过container属性 /** @var Pay */ $pay = $this->container->get(Pay::class); // 或者 $pay = ApplicationContext::getContainer()->get(Pay::class); // 支付宝支付 $result = $pay->alipay()->web([ 'out_trade_no' => ''.time(), 'total_amount' => '0.01', 'subject' => 'yansongda 测试 - 1', ]); // 微信支付 $result = $pay->wechat()->mp([ 'out_trade_no' => time(), 'total_fee' => '1', // **单位:分** 'body' => 'test body - 测试', 'openid' => 'onkVf1FjWS5SBIixxxxxxx', ]); // 记录日志 $pay->logger()->info('info message', [ 'context-key' => 'context-value', ]);