PHPackages                             xplalipay/alipay - 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. xplalipay/alipay

ActiveYii2-extension[Payment Processing](/categories/payments)

xplalipay/alipay
================

yii2支付宝支付扩展

v0.1(8y ago)015MITPHP

Since Apr 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/q490880/yii2-alipay)[ Packagist](https://packagist.org/packages/xplalipay/alipay)[ RSS](/packages/xplalipay-alipay/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

yii2-alipay
===========

[](#yii2-alipay)

yii2支付宝支付扩展

[CHANGE LOG](CHANGELOG.md)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require xplalipay/alipay

```

or add

```
"xplalipay/alipay": "*"
```

to the `require` section of your composer.json.

Configuration
-------------

[](#configuration)

To use this extension, simply add the following code in your application configuration:

```
return [
    //....
    'components' => [
		'alipay'=>[
            'class'=>'xplalipay\alipay\Alipay',
            'back_url'=> '回调地址',
            'gateway_url' => 'https://openapi.alipay.com/gateway.do',
            'app_id' => 'APPID',
            'rsa_private_key' => '私钥',
            'format' => 'json',
            'charset'=>'UTF-8',
            'sign_type'=>"RSA2",
            'alipayrsa_public_key' => "公钥"
        ],
    ],
];
```

\[获取支付密钥\]
----------

[](#获取支付密钥)

```
$token = \Yii::$app->alipay->sdkExecute([
                'body'=>'商品描述',
                'subject'=>'商品名称',
                'out_trade_no'=>'订单号',
                'timeout_express'=>'1h',
                'total_amount'=>'金额(元)',
                'product_code'=>'QUICK_MSECURITY_PAY',
            ]);
将获取到的密钥给客户端返回即可

```

\[回调代码\]
--------

[](#回调代码)

```
$resultNotify = \Yii::$app->alipay->notify();
        $result = false;
        if($resultNotify){
            $notifyData = \Yii::$app->request->post();
            $result = "回调逻辑";
        }
        if($result){
            echo 'SUCCESS';
        }else{
            echo 'ERROR';
        }

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2961d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4e81a554efaad88d33841dabc60eac511b0b9c3b06d7f5b5719c1379be35ebd?d=identicon)[q490880](/maintainers/q490880)

---

Tags

yii2alipay

### Embed Badge

![Health badge](/badges/xplalipay-alipay/health.svg)

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

###  Alternatives

[yii2mod/yii2-cashier

Yii2 Cashier provides an interface to Stripe's subscription billing services.

467.3k](/packages/yii2mod-yii2-cashier)[guanguans/yii-pay

适配于 Yii 的 alipay 和 wechat 的支付扩展包

515.5k](/packages/guanguans-yii-pay)

PHPackages © 2026

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