PHP Fluent Http Client is a library for handling http requests and responses with a fluent api.
You have two options to use it on your project :
- Installing via composer.
"require": {
"athena-oss/php-fluent-http-client": "0.7.0",
}
- Download the latest release
- header value
- content type
- status code
$responseJson = (new HttpClient())->get('http://example.com')
->withHeader('name', 'value')
->withProxy('http://myproxy.com', 3128)
->then()
->assertThat()
->headerValueIsEqual('expected_header', 'expected_value')
->responseIsJson()
->statusCodeIs(200)
->retrieve()
->fromJson();
$responseString = (new HttpClient())->put('http://example.com')
->withUserAgent('my_user_agent_string')
->withDigestAuth('myusername', 'mypassword')
->withProxy('http://myproxy', 1234)
->withBody('my content', 'my content type')
->then()
->assertThat()
->statusCodeIs(201)
->retrieve()
->fromString();
Checkout our guidelines on how to contribute in CONTRIBUTING.md.
Releases are managed using github's release feature. We use Semantic Versioning for all the releases. Every change made to the code base will be referred to in the release notes (except for cleanups and refactorings).
Licensed under the Apache License Version 2.0 (APLv2).