PHPackages                             wannanbigpig/alipay-sdk-php - 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. wannanbigpig/alipay-sdk-php

ActiveLibrary[Payment Processing](/categories/payments)

wannanbigpig/alipay-sdk-php
===========================

支付宝接口扩展包

v2.1.6(4y ago)142814MITPHPPHP &gt;=7.2CI failing

Since Jul 26Pushed 4y ago2 watchersCompare

[ Source](https://github.com/wannanbigpig/alipay-sdk-php)[ Packagist](https://packagist.org/packages/wannanbigpig/alipay-sdk-php)[ RSS](/packages/wannanbigpig-alipay-sdk-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (23)Used By (0)

Alipay SDK for PHP
==================

[](#alipay-sdk-for-php)

[![Build Status](https://camo.githubusercontent.com/a938fe66b69a6e1f177e5e85db5dfc745ba61348594f80bf2d958f8ad4f2f491/68747470733a2f2f7472617669732d63692e6f72672f77616e6e616e6269677069672f616c697061792d73646b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wannanbigpig/alipay-sdk-php) [![StyleCI](https://camo.githubusercontent.com/05a862e63e9663edcf280b247f7864910f74a973ea8e9b11ebcfbddc7743529c/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3137393234323531362f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/179242516) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/dee6ed244a6890b7e078f0ec3427ca5555e360a7a75dcc52476be5a64c964575/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f77616e6e616e6269677069672f616c697061792d73646b2d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wannanbigpig/alipay-sdk-php/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/f30160009cd10ee5ca9c618c76e18f4b98f7b8addcf757ad5544b19646648b90/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f77616e6e616e6269677069672f616c697061792d73646b2d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wannanbigpig/alipay-sdk-php/?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/911ffe472a08367786cb2b8096e90d43bbcae3ad2491e1898ca8b6a9626541eb/68747470733a2f2f706f7365722e707567782e6f72672f77616e6e616e6269677069672f616c697061792d73646b2d7068702f762f737461626c65)](https://packagist.org/packages/wannanbigpig/alipay-sdk-php) [![Latest Unstable Version](https://camo.githubusercontent.com/cd798e58e31d766a2da40f49edcb328ffdfb5fc1f62a344c2536eda9ec3a9314/68747470733a2f2f706f7365722e707567782e6f72672f77616e6e616e6269677069672f616c697061792d73646b2d7068702f762f756e737461626c65)](https://packagist.org/packages/wannanbigpig/alipay-sdk-php) [![Total Downloads](https://camo.githubusercontent.com/17a192856fb100efbb44ed6fb1411edfe605fc8b333df1137350097f7bb14dae/68747470733a2f2f706f7365722e707567782e6f72672f77616e6e616e6269677069672f616c697061792d73646b2d7068702f646f776e6c6f616473)](https://packagist.org/packages/wannanbigpig/alipay-sdk-php) [![License](https://camo.githubusercontent.com/2d0711211a608ff204f14d20343d23fbf00ce17658f8901b7cd995f111a7c7bb/68747470733a2f2f706f7365722e707567782e6f72672f77616e6e616e6269677069672f616c697061792d73646b2d7068702f6c6963656e7365)](https://packagist.org/packages/wannanbigpig/alipay-sdk-php) [![FOSSA Status](https://camo.githubusercontent.com/c3117577957d012db69d108ab79c79219bdcb6c3af6aec770b9dbbf6253c0eb6/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d25324677616e6e616e626967706967253246616c697061792d73646b2d7068702e7376673f747970653d736869656c64)](https://app.fossa.com/projects/git%2Bgithub.com%2Fwannanbigpig%2Falipay-sdk-php?ref=badge_shield)

📦 接入支付宝最新接口完成的扩展包，简化对接支付宝接口的操作，让代码看起更清晰。sdk还会自动记录每次请求支付宝网关的request和response的参数日志。自动校验返回值等...

说明
--

[](#说明)

- 在使用SDK之前请确认你已经仔细阅读了：[**支付宝开放平台文档**](https://docs.open.alipay.com/)
- 在使用中出现问题，那么可以在这里提问 [Issues](https://github.com/wannanbigpig/alipay-sdk-php/issues)
- 欢迎 Star，欢迎 PR！

### 运行环境

[](#运行环境)

- PHP 7.0+
- composer
- openssl 拓展

### 开发工具

[](#开发工具)

[![PhpStorm](https://github.com/wannanbigpig/alipay-sdk-php/raw/master/phpstorm.png)](https://www.jetbrains.com/?from=alipay-sdk-php)

### 安装

[](#安装)

```
composer require wannanbigpig/alipay-sdk-php

```

### 使用

[](#使用)

```
use EasyAlipay\Alipay;

// 配置（包含支付宝的公共配置，日志配置，http配置等）
$config = [
    'sys_params' => [
        'app_id' => '888888888888888',
        'notify_url' => 'http://alipay.docs.wannanbigpig.com/',
        'return_url' => 'http://alipay.docs.wannanbigpig.com/',
    ],
    'private_key_path' => STORAGE_ROOT.'private_key.pem',
    'alipay_public_Key_path' => STORAGE_ROOT.'alipay_public_key.pem',
];

$app = Alipay::payment($config);

// 当面付 统一收单交易支付接口
$response = $app->pay([
    'out_trade_no' => \WannanBigPig\Supports\Str::getRandomInt(),
    'scene' => 'bar_code',
    'auth_code' => '283867319836385922',
    'subject' => 'ceshiapi',
    'total_amount' => '100',
]);

if($response['code'] === '10000'){
    echo $response['trade_no'];    // 2019072722001491681000180973
}
```

更多请参考：[详细开发文档](https://alipay.docs.wannanbigpig.com/)

### 代码贡献

[](#代码贡献)

目前只对接各类支付，资金预授权等相关接口。如果您有其它支付宝相关接口的需求，或者发现本项目中需要改进的代码，***欢迎 Fork 并提交 PR！***

### LICENSE

[](#license)

MIT

[![FOSSA Status](https://camo.githubusercontent.com/1377edee6398c0b88a3a27e08fca3fb24a2c58a2485a2d481e10477f0bf6ff33/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d25324677616e6e616e626967706967253246616c697061792d73646b2d7068702e7376673f747970653d6c61726765)](https://app.fossa.com/projects/git%2Bgithub.com%2Fwannanbigpig%2Falipay-sdk-php?ref=badge_large)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~40 days

Recently: every ~174 days

Total

22

Last Release

1645d ago

PHP version history (2 changes)2.0.1PHP &gt;=7.0

v2.1.4PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/47f86ccf2ac64f362b2ee3da04998e8931d230feada45094829eacfd7408ad6a?d=identicon)[liuml](/maintainers/liuml)

---

Top Contributors

[![wannanbigpig](https://avatars.githubusercontent.com/u/48752601?v=4)](https://github.com/wannanbigpig "wannanbigpig (222 commits)")[![liumenglei](https://avatars.githubusercontent.com/u/17676394?v=4)](https://github.com/liumenglei "liumenglei (73 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")

---

Tags

payalipay

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wannanbigpig-alipay-sdk-php/health.svg)

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

###  Alternatives

[yansongda/pay

可能是我用过的最优雅的 Alipay 和 WeChat 的支付 SDK 扩展包了

5.3k1.2M53](/packages/yansongda-pay)[yansongda/laravel-pay

专注 Alipay/WeChat/Unipay 的 laravel 支付扩展包

1.1k353.2k9](/packages/yansongda-laravel-pay)[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

587421.0k11](/packages/lokielse-omnipay-alipay)[yansongda/hyperf-pay

可能是基于 hyperf 的最优雅的支付宝、微信、银联支付 SDK 了

8959.8k1](/packages/yansongda-hyperf-pay)[lokielse/omnipay-global-alipay

Alipay global gateway for Omnipay payment processing library

3048.9k](/packages/lokielse-omnipay-global-alipay)[guanguans/yii-pay

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

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

PHPackages © 2026

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