PHPackages                             hjiash/easypay - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. hjiash/easypay

ActiveLibrary[Payment Processing](/categories/payments)

hjiash/easypay
==============

an integration for third party payment

v1.0.1(10y ago)1101MITPHP

Since May 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/hjiash/easypay)[ Packagist](https://packagist.org/packages/hjiash/easypay)[ Docs](https://github.com/hjiash/EasyPay)[ RSS](/packages/hjiash-easypay/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

### 1. 说明

[](#1-说明)

使用前，请进入src/目录下，复制Configuration.php.example并重命名为Configuration.php，配置好参数。

所有属性值支持以下方式进行set/get:

```
$this->setParameter('key', $value);
$this->getParameter('key');
```

另外，微信支付支持将参数名转换成大驼峰，前面加get/set的方法名获取，如

```
$request->getOutTradeNo();
$request->setOutTradeNo();
```

### 以下是demo

[](#以下是demo)

> 微信扫码支付

```
$order = [
	'body' => '商品描述',
	'detail' => '商品详情',
	'out_trade_no' => createOrderNumber(),
	'product_id' => 1,
	'total_fee' => 1,
	'spbill_create_ip' => getClientIp(),
	'notify_url' => 'http://test.com',
];
$context = new PaymentContext('Strategy\WechatPay\WechatUnifiedPay');
$context->execute($order);
$result = $context->getResult();
$result->getCodeUrl();
```

> 微信公众号内支付

```
$order = [
	'body' => '商品描述',
	'detail' => '商品详情',
	'out_trade_no' => createOrderNumber(),
	'total_fee' => 1,
	'spbill_create_ip' => getClientIp(),
	'notify_url' => 'http://test.com',
	'openid' => 'openid'
];
$context = new PaymentContext('Strategy\WechatPay\WechatJsPay');
$context->execute($order);
$result = $context->getResult();
$result->createWebPaymentPackage();
```

> 微信APP支付

```
$order = [
 'body' => '商品描述',
 'detail' => '商品详情',
 'out_trade_no' => createOrderNumber(),
 'total_fee' => 1,
 'spbill_create_ip' => getClientIp(),
 'notify_url' => 'http://test.com',
 'openid' => 'openid'
];
$context = new PaymentContext('Strategy\WechatPay\WechatAppPay');
$context->execute($order);
$result = $context->getResult();
```

> 微信支付结果回调

```
use \ChengFang\EasyPay\Traits\WechatPayNotify;

$body = file_get_contents('php://input');
$context = new PaymentContext('Strategy\WechatPay\WechatPayNotify');
$context->execute($body);

try{
    $result = $context->getResult();
    /**
     * result是CompleteOrderResponse的对象
     * 可以根据微信支付文档，将参数转化成驼峰的形式获取返回值
    */

    // $result->getTransactionId();
    // $result->getOutTradeNo();

    // $this->success($message = null);
    $this->success('信息可以不需要');
}catch(Exception $e){
    // $this->fail($message = null);
    $this->fail('信息可以不需要');
}
```

> 微信红包

```
$redPack = [
    'send_name' => '广州乘方',
    're_openid' => 'o6FwguKysTyj3zlikp8U8DwHk4XA',
    'total_amount' => 100,
    'total_num' => 1,
    'wishing' => '祝福语',
    'client_ip' => getClientIp(),
    'act_name' => '活动名称',
    'remark' => '备注'
];
$context = new PaymentContext('Strategy\WechatPay\WechatRedPack');
$context->execute($redPack);
$result = $context->getResult();
echo $result->getSendListid();
```

> 支付宝PC即时到账

```
$order = [
	'subject' => '商品描述',
	'body' => '商品详情',
	'out_trade_no' => createOrderNumber(),
	'total_fee' => 0.01,
	'notify_url' => '',
	'return_url' => ''
];
$context = new PaymentContext('Strategy\Alipay\AlipayPcExpress');
$context->execute($order);
echo $context->getResult()->getRedirectUrl();
```

> 支付宝手机即时到账

```
$order = [
	'subject' => '商品描述',
	'body' => '商品详情',
	'out_trade_no' => createOrderNumber(),
	'total_fee' => 0.01,
	'notify_url' => '',
	'return_url' => ''
];
$context = new PaymentContext('Strategy\Alipay\AlipayWapExpress');
$context->execute($order);
echo $context->getResult()->getRedirectUrl();
```

> 支付宝支付结果回调

```
use \ChengFang\EasyPay\Traits\AlipayNotify;

$body = Input::get();
$context = new PaymentContext('Strategy\WechatPay\WechatPayNotify');
$context->execute($body);

try{
    $result = $context->getResult();

    // $result->getRequest()->getRequestParam('trade_no');
    // $result->getRequest()->getRequestParam('out_trade_no');

    $this->success();
}catch(Exception $e){
    $this->fail();
}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3663d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f5cafef2db620f78ebe6dd18d8acaca96e868a02ae93f815d89447a7002b538?d=identicon)[jason.y](/maintainers/jason.y)

---

Top Contributors

[![hjiash](https://avatars.githubusercontent.com/u/3822120?v=4)](https://github.com/hjiash "hjiash (7 commits)")

---

Tags

phpeasypaythird party payment

### Embed Badge

![Health badge](/badges/hjiash-easypay/health.svg)

```
[![Health](https://phpackages.com/badges/hjiash-easypay/health.svg)](https://phpackages.com/packages/hjiash-easypay)
```

###  Alternatives

[omalizadeh/laravel-multi-payment

A driver-based laravel package for online payments via multiple gateways

491.1k](/packages/omalizadeh-laravel-multi-payment)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
