PHPackages                             linwj/gate - 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. linwj/gate

ActiveLibrary[API Development](/categories/api)

linwj/gate
==========

Gate API Like the official document interface, Support for arbitrary extension.

1.0.7(2y ago)26.1k31MITPHPPHP &gt;=7.0

Since Jul 14Pushed 2y ago2 watchersCompare

[ Source](https://github.com/zhouaini528/gate-php)[ Packagist](https://packagist.org/packages/linwj/gate)[ RSS](/packages/linwj-gate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (1)

### It is recommended that you use the test server first

[](#it-is-recommended-that-you-use-the-test-server-first)

The official address [API2](https://www.gatecn.io/api2) [API4](https://www.gatecn.io/docs/futures/api/index.html)

All interface methods are initialized the same as those provided by Bitmex. See details [src/api](https://github.com/zhouaini528/gate-php/tree/master/src/Api)

Most of the interface is now complete, and the user can continue to extend it based on my design, working with me to improve it.

[中文文档](https://github.com/zhouaini528/gate-php/blob/master/README_CN.md)

### Other exchanges API

[](#other-exchanges-api)

[Exchanges](https://github.com/zhouaini528/exchanges-php) It includes all of the following exchanges and is highly recommended.

[Bitmex](https://github.com/zhouaini528/bitmex-php) Support [Websocket](https://github.com/zhouaini528/bitmex-php/blob/master/README.md#Websocket)

[Okex](https://github.com/zhouaini528/okex-php) Support [Websocket](https://github.com/zhouaini528/okex-php/blob/master/README.md#Websocket)

[Huobi](https://github.com/zhouaini528/huobi-php) Support [Websocket](https://github.com/zhouaini528/huobi-php/blob/master/README.md#Websocket)

[Binance](https://github.com/zhouaini528/binance-php) Support [Websocket](https://github.com/zhouaini528/binance-php/blob/master/README.md#Websocket)

[Kucoin](https://github.com/zhouaini528/kucoin-php)

[Mxc](https://github.com/zhouaini528/Mxc-php)

[Coinbase](https://github.com/zhouaini528/coinbase-php)

[ZB](https://github.com/zhouaini528/zb-php)

[Bitfinex](https://github.com/zhouaini528/bitfinex-php)

[Bittrex](https://github.com/zhouaini528/bittrex-php)

[Kraken](https://github.com/zhouaini528/kraken-php)

[Gate](https://github.com/zhouaini528/gate-php)

[Bigone](https://github.com/zhouaini528/bigone-php)

[Crex24](https://github.com/zhouaini528/crex24-php)

[Bybit](https://github.com/zhouaini528/bybit-php)

[Coinbene](https://github.com/zhouaini528/coinbene-php)

[Bitget](https://github.com/zhouaini528/bitget-php)

[Poloniex](https://github.com/zhouaini528/poloniex-php)

#### Installation

[](#installation)

```
composer require linwj/gate

```

Support for more request Settings

```
$gate=new GateSpot();//defult api v4
$gate=new GateSpotV2();//defult api v2

//You can set special needs
$gate->setOptions([
    //Set the request timeout to 60 seconds by default
    'timeout'=>10,

    //If you are developing locally and need an agent, you can set this
    'proxy'=>true,
    //More flexible Settings
    /* 'proxy'=>[
     'http'  => 'http://127.0.0.1:12333',
     'https' => 'http://127.0.0.1:12333',
     'no'    =>  ['.cn']
     ], */
    //Close the certificate
    //'verify'=>false,
]);
```

### Spot Market API V4

[](#spot-market-api-v4)

Market related API [More](https://github.com/zhouaini528/gate-php/blob/master/tests/spot/market.php)

```
$gate=new GateSpot();

try {
    $result=$gate->market()->getTickers();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->market()->getOrderBook([
        'currency_pair'=>'BTC_USDT'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->market()->getTrades([
        'currency_pair'=>'BTC_USDT'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->market()->getCandlesticks([
        'currency_pair'=>'BTC_USDT'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}
```

### Spot Order API V4

[](#spot-order-api-v4)

Order API V4 [More](https://github.com/zhouaini528/gate-php/blob/master/tests/spot/order.php)

```
$gate=new GateSpot($key,$secret);

//bargaining transaction
try {
    $result=$gate->order()->post([
        //'text'=>'t-xxxxxxxxxx',//custom ID
        'currency_pair'=>'BTC_USDT',
        'type'=>'limit',
        'side'=>'buy',
        'amount'=>'0.1',
        'price'=>'4000',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//track the order
try {
    $result=$gate->order()->get([
        'currency_pair'=>'BTC_USDT',
        'order_id'=>'xxxxxxxxxx',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//cancellation of order
try {
    $result=$gate->order()->delete([
        'currency_pair'=>'BTC_USDT',
        'order_id'=>'xxxxxxxxxx',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}
```

More Test [more](https://github.com/zhouaini528/gate-php/tree/master/tests/spot)

More Api [more](https://github.com/zhouaini528/gate-php/tree/master/src/Api/Spot)

### Future and Delivery Market API V4

[](#future-and-delivery-market-api-v4)

Market related API [More](https://github.com/zhouaini528/gate-php/blob/master/tests/future/market.php)

```
$gate=new GateFuture();
$gate=new GateDelivery();

try {
    $result=$gate->market()->getTickers(['settle'=>'btc']);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->market()->getOrderBook([
        'settle'=>'btc',
        'contract'=>'BTC_USD'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->market()->getTrades([
        'settle'=>'btc',
        'contract'=>'BTC_USD'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->market()->getCandlesticks([
        'settle'=>'btc',
        'contract'=>'BTC_USD'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}
```

### Future and Delivery Order API V4

[](#future-and-delivery-order-api-v4)

Order API V4 [More](https://github.com/zhouaini528/gate-php/blob/master/tests/future/order.php)

```
$gate=new GateFuture($key,$secret);
$gate=new GateDelivery($key,$secret);

//bargaining transaction
try {
    $result=$gate->order()->post([
        //'text'=>'t-xxxxxxxxxx',//custom ID
        'settle'=>'btc',
        'contract'=>'BTC_USD',
        'size'=>'1',
        'price'=>'4000',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//track the order
try {
    $result=$gate->order()->get([
        'settle'=>'btc',
        'order_id'=>'xxxxxxxxxx',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//cancellation of order
try {
    $result=$gate->order()->delete([
        'settle'=>'btc',
        'order_id'=>'xxxxxxxxxx',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}
```

### Spot Public API V2

[](#spot-public-api-v2)

Market related API [More](https://github.com/zhouaini528/gate-php/blob/master/tests/spot_v2/publics.php)

```
$gate=new GateSpotV2();

try {
    $result=$gate->publics()->pairs();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->publics()->marketinfo();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}
```

### Spot Private API V2

[](#spot-private-api-v2)

Private API V2 [More](https://github.com/zhouaini528/gate-php/blob/master/tests/spot_v2/privates.php)

```
$gate=new GateSpotV2($key,$secret);

//bargaining transaction
try {
    $result=$gate->privates()->buy([
        'currencyPair'=>'btc_usdt',
        'rate'=>'3000',
        'amount'=>'0.01',
        //'text'=>'t-xxxxxxxxxx'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//track the order
try {
    $result=$gate->privates()->getOrder([
        'currencyPair'=>'btc_usdt',
        'orderNumber'=>'xxxxxxxxxx',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//cancellation of order
try {
    $result=$gate->privates()->cancelOrder([
        'currencyPair'=>'btc_usdt',
        'orderNumber'=>'xxxxxxxxxx',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//more
try {
    $result=$gate->privates()->balances();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$gate->privates()->depositAddress(['currency'=>'BTC']);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}
```

More Test [more](https://github.com/zhouaini528/gate-php/tree/master/tests/spot_v2)

More Api [more](https://github.com/zhouaini528/gate-php/tree/master/src/Api/SpotV2)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~179 days

Recently: every ~313 days

Total

8

Last Release

880d ago

### Community

Maintainers

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

---

Top Contributors

[![zhouaini528](https://avatars.githubusercontent.com/u/5442664?v=4)](https://github.com/zhouaini528 "zhouaini528 (28 commits)")

---

Tags

bitfinexbitmexbittrexcoinbasegatehuobiokexgatecoinbasebinanceBitMEXHuobiOKEXkucoinkumex

### Embed Badge

![Health badge](/badges/linwj-gate/health.svg)

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

###  Alternatives

[linwj/exchanges

This is a virtual currency SDK that brings together multiple exchanges

2546.8k](/packages/linwj-exchanges)[linwj/coinbase

Coinbase API Like the official document interface, Support for arbitrary extension.

1311.4k1](/packages/linwj-coinbase)[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

41.5k328.9k1](/packages/ccxt-ccxt)[linwj/bybit

Bybit API Like the official document interface, Support for arbitrary extension.

3010.5k1](/packages/linwj-bybit)[linwj/mxc

Mexc API Like the official document interface, Support for arbitrary extension.

207.3k1](/packages/linwj-mxc)[linwj/binance

Binance API Like the official document interface, Support for arbitrary extension.

11617.7k1](/packages/linwj-binance)

PHPackages © 2026

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