Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mindplay-dk committed Jul 4, 2019
1 parent 45d759b commit 6855273
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# `kodus/http-client`

Minimalist [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP Client.

[![PHP Version](https://img.shields.io/badge/php-7.1%2B-blue.svg)](https://packagist.org/packages/kodus/http-client)
[![Build Status](https://travis-ci.org/kodus/http-client.svg?branch=master)](https://travis-ci.org/kodus/http-client)
[![Code Coverage](https://scrutinizer-ci.com/g/kodus/http-client/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/kodus/http-client/?branch=master)

* No dependencies beyond [PSR-17](https://www.php-fig.org/psr/psr-17/) HTTP Factory implementations
* Streaming response: suitable for fetching large responses.
* Accepts and decodes `gzip` encoded response content.

Note that this client does not follow redirects: PSR-18 doesn't specify - but this is a client, not a browser,
and it's designed to be bootstrapped as a service instance: some dependents may need to know the status-code of
the actual response; automatically following redirects makes that impossible.

## Usage

Basic example using [`nyholm/psr7`](https://packagist.org/packages/nyholm/psr7):

```php
use Kodus\Http\HttpClient;
use Nyholm\Psr7\Factory\Psr17Factory;

// Bootstrap the client:

$http = new Psr17Factory();

$client = new HttpClient($http, $http);

// Perform a request:

$response = $client->sendRequest(
$http->createRequest("GET", "https://postman-echo.com/get?foo=bar")
);
```

Please refer to [PSR-18 documentation](https://www.php-fig.org/psr/psr-18/) for details.

0 comments on commit 6855273

Please sign in to comment.