jsnlib/restful_client

Maintainers

Package info

github.com/fdjkgh580/jsnlib-restful_client

Homepage

pkg:composer/jsnlib/restful_client

Statistics

Installs: 155

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

1.3.0 2019-02-11 13:13 UTC

This package is auto-updated.

Last update: 2026-03-12 07:27:50 UTC


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);