https://github.com/xutl/gateio
https://github.com/xutl/gateio
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/xutl/gateio
- Owner: xutl
- License: mit
- Created: 2017-11-29T12:29:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-29T13:04:08.000Z (over 7 years ago)
- Last Synced: 2025-01-20T12:46:37.222Z (4 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gateio-guzzle
For license information check the [LICENSE](LICENSE)-file.
[](https://packagist.org/packages/xutl/gateio)
[](https://packagist.org/packages/xutl/gateio)Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist xutl/gateio
```or add
```
"xutl/gateio": "~1.0"
```to the require section of your composer.json.
使用
------------
````
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use xutl\gateio\Gateio;$stack = HandlerStack::create();
//跟guzzlephp普通用法唯一的区别就是这里吧中间件加载进来,他会自动帮你签名重新包装请求参数。
$middleware = new Gateio([
'accessKey' => '123456',
'accessSecret' => '654321',
]);
$stack->push($middleware);//这里设置 网关地址,数组参数请参见 https://gate.io/api2
$client = new Client([
'base_uri' => 'https://api.gate.io/api2/1',
'handler' => $stack,
]);$res = $client->get('private/cancelOrders', [
'query' => [
'aaa' => 'bbb',
]
]);$res = $client->post('private/cancelOrders', [
'form_params' => [
'orders_json' => 'adafasdf'
]
]);print_r($res->getBody()->getContents());
````