https://github.com/xavier-lam/shisa-httpclient
A simple lightweight HTTP client for php
https://github.com/xavier-lam/shisa-httpclient
Last synced: 2 months ago
JSON representation
A simple lightweight HTTP client for php
- Host: GitHub
- URL: https://github.com/xavier-lam/shisa-httpclient
- Owner: Xavier-Lam
- License: mit
- Created: 2020-09-11T08:40:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-01T09:54:59.000Z (almost 4 years ago)
- Last Synced: 2025-01-30T04:25:32.774Z (4 months ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTTPClient
A simple lightweight http client for PHP.
## Installation
composer require shisa/httpclient
## Quickstart
use Shisa\HTTPClient\Clients\HTTPClient;
use Shisa\HTTPClient\Formatters\JsonFormatter;$client = new HTTPClient();
$client->setBaseUrl('https://baidu.com');
$formatter = new JsonFormatter();
$client->setFormatter($formatter);
$response = $client->send('/debug', 'POST', ['data' => 1]);
$data = $response->json();## Usages
### Extend## TODOS
## Changelog
### 0.2.1
* (BREAKING CHANGE) createRequest方法改为public方法
* 增加FormData Formatter
* 允许给`Request`对象增加属性### 0.2.0
* Auth的isInvalidAuthError改为接受Exception异常
* 增加authRequestPostPrepare方法
* PreparedRequest的headers改为Key: value