PHPackages                             antom/global-open-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. [API Development](/categories/api)
4. /
5. antom/global-open-sdk-php

ActiveLibrary[API Development](/categories/api)

antom/global-open-sdk-php
=========================

global-open-sdk-php

v1.4.33(3d ago)2426.4k↑31.2%10[7 issues](https://github.com/alipay/global-open-sdk-php/issues)[55 PRs](https://github.com/alipay/global-open-sdk-php/pulls)5MITPHP

Since Aug 27Pushed 1mo ago7 watchersCompare

[ Source](https://github.com/alipay/global-open-sdk-php)[ Packagist](https://packagist.org/packages/antom/global-open-sdk-php)[ Docs](https://dashboard.alipay.com/global-payments/)[ RSS](/packages/antom-global-open-sdk-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)DependenciesVersions (133)Used By (5)

```
Language：PHP
PHP version：7.1+
Releass ^1.4.32
Copyright：Ant financial services group

```

### Composer

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require antom/global-open-sdk-php
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once 'vendor/autoload.php';
```

### Manual Installation

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/alipay/global-open-sdk-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once '/path/to/global-open-sdk-php/init.php';
```

### Requirements

[](#requirements)

PHP 7.1 or higher

#### Legacy version support

[](#legacy-version-support)

If using PHP versions 7.1 or lower, download our library version 1.4.13.

#### 1 Important note

[](#1-important-note)

The SDK mainly shows how to access the alipay gateway, which cannot guarantee the performance and stability.

#### 2 The demo code for create payment

[](#2-the-demo-code-for-create-payment)

```
    use Request\pay\AlipayPayRequest;
    use Client\DefaultAlipayClient;
    use Model\Amount;
    use Model\Buyer;
    use Model\Env;
    use Model\Merchant;
    use Model\Order;
    use Model\OsType;
    use Model\PaymentFactor;
    use Model\PaymentMethod;
    use Model\PresentmentMode;
    use Model\ProductCodeType;
    use Model\SettlementStrategy;
    use Model\Store;
    use Model\TerminalType;
    use Model\WalletPaymentMethodType;

    $request = new AlipayPayRequest();
    $paymentRequestId = 'PR_' . round(microtime(true) * 1000);
    $order = new Order();
    $order->setOrderDescription("test order desc");
    $order->setReferenceOrderId("102775745075668");
    $orderAmount = new Amount();
    $orderAmount->setCurrency("HKD");
    $orderAmount->setValue("100");
    $order->setOrderAmount($orderAmount);

    $merchant = new Merchant();
    $merchant->setReferenceMerchantId('seller2322174590001');
    $merchant->setMerchantMCC('7011');
    $merchant->setMerchantName('Some_Mer');

    $store = new Store();
    $store->setStoreMCC('7011');
    $store->setReferenceStoreId('store232217459000021');
    $store->setStoreName('Some_Store');

    $merchant->setStore($store);

    $order->setMerchant($merchant);

    $env = new Env();
    $env->setUserAgent('"Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 NebulaSDK/1.8.100112 Nebula PSDType(1) AlipayDefined(nt:4G,ws:320|504|2.0) AliApp(AP/10.1.32.600) AlipayClient/10.1.32.600 Alipay Language/zh-Hans AlipayConnect"');
    $env->setOsType(OsType::ANDROID);
    $env->setTerminalType(TerminalType::WEB);
    $order->setEnv($env);

    $request->setOrder($order);

    $paymentAmount = new Amount();
    $paymentAmount->setCurrency("HKD");
    $paymentAmount->setValue("100");
    $request->setPaymentAmount($paymentAmount);

    $paymentNotifyUrl = "https://www.alipay.com/notify";
    $paymentRedirectUrl = "https://www.alipay.com";

    $request->setPaymentNotifyUrl($paymentNotifyUrl);
    $request->setPaymentRedirectUrl($paymentRedirectUrl);

    $paymentMethod = new PaymentMethod();
    $paymentMethod->setPaymentMethodType(WalletPaymentMethodType::ALIPAY_HK);
    $request->setPaymentMethod($paymentMethod);

    $request->setProductCode(ProductCodeType::CASHIER_PAYMENT);

    $request->setClientId(clientId);

    $request->setPaymentRequestId($paymentRequestId);

    $settlementStrategy = new SettlementStrategy();
    $settlementStrategy->setSettlementCurrency("USD");
    $request->setSettlementStrategy($settlementStrategy);

    $alipayClient = new DefaultAlipayClient("https://open-sea-global.alipay.com", merchantPrivateKey, alipayPublicKey);
    $alipayResponse = $alipayClient->execute($request);

```

The execute method contains the HTTP request to the gateway.

If you're concerned about HTTP invocation performance, you can implement HTTP invocation yourself.

```
class YourAlipayClient extends  \Client\BaseAlipayClient{

     function __construct()
    {
        $a = func_get_args();
        $i = func_num_args() - 2;
        if (method_exists($this, $f = '__construct' . $i)) {
            call_user_func_array(array($this, $f), $a);
        }
    }

    function __construct1($gatewayUrl, $merchantPrivateKey, $alipayPublicKey)
    {
        parent::__construct($gatewayUrl, $merchantPrivateKey, $alipayPublicKey);
    }

    function __construct2($gatewayUrl, $merchantPrivateKey, $alipayPublicKey, $clientId)
    {
        parent::__construct($gatewayUrl, $merchantPrivateKey, $alipayPublicKey, $clientId);
    }

    protected function buildCustomHeader(){
        return null;
    }

    protected function sendRequest($requestUrl, $httpMethod, $headers, $reqBody){
        $httpRpcResult = new HttpRpcResult();

        // TODO
        // $httpRpcResult->setRspBody($rspBody);
        // $httpRpcResult->setRspSign($rspSign);
        // $httpRpcResult->setRspTime($rspTime);

        return $httpRpcResult;
    }

}

$yourAlipayClient  = new YourAlipayClient("https://open-sea.alipay.com", $merchantPrivateKey, $alipayPublicKey);
$alipayPayResponse = $yourAlipayClient->execute($aliPayRequest);

```

#### 3 If you don't care about HTTP calls,the sample for sign and verify

[](#3-if-you-dont-care-about-http-callsthe-sample-for-sign-and-verify)

```
$signReqValue  = SignatureTool::sign($httpMethod, $path, $clientId, $reqTime, $reqBody, $merchantPrivateKey);
$isVerifyPass  = SignatureTool::verify($httpMethod, $path, $clientId, $rspTime, $rspBody, $rspSignValue, $alipayPublicKey);

```

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance89

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.8% 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 ~19 days

Recently: every ~29 days

Total

36

Last Release

3d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/176393392?v=4)[wangzunjiao\_guodong](/maintainers/wangzunjiao)[@wangzunjiao](https://github.com/wangzunjiao)

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

![](https://avatars.githubusercontent.com/u/29004894?v=4)[yimu](/maintainers/yimu)[@yimu](https://github.com/yimu)

---

Top Contributors

[![wangzunjiao](https://avatars.githubusercontent.com/u/176393392?v=4)](https://github.com/wangzunjiao "wangzunjiao (127 commits)")[![lifelong-creator](https://avatars.githubusercontent.com/u/56951540?v=4)](https://github.com/lifelong-creator "lifelong-creator (27 commits)")[![ScottWryyyyy](https://avatars.githubusercontent.com/u/110525967?v=4)](https://github.com/ScottWryyyyy "ScottWryyyyy (21 commits)")[![YiChengZQZ](https://avatars.githubusercontent.com/u/280292238?v=4)](https://github.com/YiChengZQZ "YiChengZQZ (2 commits)")[![antfin-oss](https://avatars.githubusercontent.com/u/48939886?v=4)](https://github.com/antfin-oss "antfin-oss (1 commits)")[![zhaoyou-lsy](https://avatars.githubusercontent.com/u/208583448?v=4)](https://github.com/zhaoyou-lsy "zhaoyou-lsy (1 commits)")[![GsySniff](https://avatars.githubusercontent.com/u/104355744?v=4)](https://github.com/GsySniff "GsySniff (1 commits)")[![tcboy](https://avatars.githubusercontent.com/u/3973797?v=4)](https://github.com/tcboy "tcboy (1 commits)")[![zhanggl](https://avatars.githubusercontent.com/u/1940335?v=4)](https://github.com/zhanggl "zhanggl (1 commits)")

### Embed Badge

![Health badge](/badges/antom-global-open-sdk-php/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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