jsnlib / restful_client
Installs: 155
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/jsnlib/restful_client
Requires
- php: >=7.0.0
- guzzlehttp/guzzle: ^6.2
- jsnlib/ao: ^1.2.0
README
安裝
composer require jsnlib/restful_client
使用方式
require_once '../vendor/autoload.php'; $client = new \Jsnlib\Restful\Client( [ 'base_uri' => 'http://dev.api.westamps.com/v1/' ]);
$result = $client->get('method', [ 'Say' => 'Hello World' ]); $result = $client->post('method', [ 'Say' => 'Hello World' ]); $result = $client->put('method', [ 'Say' => 'Hello World' ]); $result = $client->patch('method', [ 'Say' => 'Hello World' ]); $result = $client->delete('method', [ 'Say' => 'Hello World' ]);
POST
文件上傳,如 video 有多筆
$result = $client->post('method', [ [ 'name' => 'video[]', 'contents' => fopen('demo/demo.mp4', 'r') ], ], true);