943626451/easywechat-for-hyperf

微信SDK-兼容hyperf

Maintainers

👁 943626451

Package info

github.com/jonny77/easywechat-for-hyperf

pkg:composer/943626451/easywechat-for-hyperf

Statistics

Installs: 18

Dependents: 0

Suggesters: 0

Stars: 1

5.6.1 2021-06-29 09:27 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT cea29ca716e42b66bff806d395871fb89ac968f1

  • fg <jonny_77.woop@msn.cn>

sdkwechatweixinweixin-sdkeasywechatwexinpay-for-hyperf

This package is auto-updated.

Last update: 2026-05-29 02:01:17 UTC


README

本项目fork自https://github.com/w7corp/easywechat 基础使用方法参照其文档即可. 这里主要说一下怎么适配给hyperf

<?php
namespace App\Listener\PayListener;


use EasyWeChat\Factory;
use Hyperf\HttpServer\Contract\RequestInterface;

class WechatPayBase
{

 public function initPay()
 {
 $payConfig = [
 'app_id' => env('MINI_APPID'),
 'mch_id' => env('MINI_MCHID'),
 'key' => env('MINI_PAYKEY'),
 // 如需使用敏感接口(如退款、发送红包等)需要配置 API 证书路径
// 'cert_path' => 'path/to/your/cert.pem', // 绝对路径
// 'key_path' => 'path/to/your/key', // 绝对路径,
 'notify_url' => env('MINI_NOTIFYURL')
 ];
 $app = Factory::payment($payConfig);
 $request = di(RequestInterface::class);//重点
 $app->rebind('request',$request);//重点
 return $app;
 }

}