progresivjose / arc-api-connector
一个简单的Guzzle包装器,带有一些特定参数以连接到Arc XP API
2.0
2023-11-16 19:34 UTC
Requires
- php: >=8.2.11
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- mockery/mockery: ^1.4.4
- pestphp/pest: ^2.24
README
要安装此包,您应运行以下命令
composer require progrevisjose/arc-api-connector:1.0
用法
首先,您必须初始化类
import GuzzleHttp\Client; $client = new \Progresivjose\ArcApiConnector(new Client, 'ARC API SECRET TOKEN');
然后,您就可以开始发起请求
//making a simple request $this->client->get('https://example.test'); //passing params to the request $this->client->get('https://example.test', ['foo' => 'bar']); //example of post as form_params $this->client->post('https://example.test'. ['name' => 'John', 'lastname' => 'Doe']); //example of post as json body $this->client->post('http://example.test', ['name' => 'John', 'lastname' => 'Doe'], 'json'); //example of post as multipart $this->client->post('http://example.test', ['name' => 'John', 'lastname' => 'Doe'], 'multipart');
可用方法
- get
- post
- put
- delete