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.29(2mo ago)2413.2k↓29.6%9[7 issues](https://github.com/alipay/global-open-sdk-php/issues)[23 PRs](https://github.com/alipay/global-open-sdk-php/pulls)4MITPHP

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 1mo ago

READMEChangelog (10)DependenciesVersions (92)Used By (4)

```
Language：PHP
PHP version：7.1+
Releass ^1.4.29
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

52

—

FairBetter than 96% of packages

Maintenance82

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.4% 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 ~17 days

Recently: every ~12 days

Total

32

Last Release

75d ago

### Community

Maintainers

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

---

Top Contributors

[![wangzunjiao](https://avatars.githubusercontent.com/u/176393392?v=4)](https://github.com/wangzunjiao "wangzunjiao (120 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)")[![zhanggl](https://avatars.githubusercontent.com/u/1940335?v=4)](https://github.com/zhanggl "zhanggl (1 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)")

### 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

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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