Skip to content

Commit 4a75b08

Browse files
committed
:octocat:
1 parent 352ad48 commit 4a75b08

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

Diff for: .phan/config.php

+4
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@
5252
'tests',
5353
'vendor',
5454
],
55+
'suppress_issue_types' => [
56+
'PhanAccessMethodInternal',
57+
'PhanTypeInvalidThrowsIsInterface',
58+
],
5559
];

Diff for: README.md

+30-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# chillerlan/php-httpinterface
22

3-
A [PSR-7](https://www.php-fig.org/psr/psr-7/)/[PSR-17](https://www.php-fig.org/psr/psr-17/)/[PSR-18](https://www.php-fig.org/psr/psr-18/) implementation.
3+
A [PSR-7](https://www.php-fig.org/psr/psr-7/)/[PSR-17](https://www.php-fig.org/psr/psr-17/)/[PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP message/client implementation.
44

55
[![PHP Version Support][php-badge]][php]
66
[![version][packagist-badge]][packagist]
@@ -34,26 +34,34 @@ An API documentation created with [phpDocumentor](https://www.phpdoc.org/) can b
3434
## Requirements
3535
- PHP 8.1+
3636
- [`ext-curl`](https://www.php.net/manual/book.curl.php)
37-
- [`ext-json`](https://www.php.net/manual/book.json.php)
38-
- [`ext-mbstring`](https://www.php.net/manual/book.mbstring.php)
39-
- [`ext-simplexml`](https://www.php.net/manual/book.simplexml.php)
40-
- [`ext-zlib`](https://www.php.net/manual/book.zlib.php)
37+
- from dependencies:
38+
- [`ext-fileinfo`](https://www.php.net/manual/book.fileinfo.php)
39+
- [`ext-intl`](https://www.php.net/manual/book.intl.php)
40+
- [`ext-json`](https://www.php.net/manual/book.json.php)
41+
- [`ext-mbstring`](https://www.php.net/manual/book.mbstring.php)
42+
- [`ext-simplexml`](https://www.php.net/manual/book.simplexml.php)
43+
- [`ext-zlib`](https://www.php.net/manual/book.zlib.php)
4144

4245

43-
## Installation
44-
**requires [composer](https://getcomposer.org)**
46+
## Installation with [composer](https://getcomposer.org)
47+
48+
### Terminal
49+
50+
```
51+
composer require chillerlan/php-httpinterface
52+
```
53+
54+
### composer.json
4555

46-
*composer.json* (note: replace `dev-main` with a [version boundary](https://getcomposer.org/doc/articles/versions.md))
4756
```json
4857
{
4958
"require": {
5059
"php": "^8.1",
51-
"chillerlan/php-httpinterface": "dev-main"
60+
"chillerlan/php-httpinterface": "dev-main#<commit_hash>"
5261
}
5362
}
5463
```
55-
Note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^5.0` - see [releases](https://github.com/chillerlan/php-httpinterface/releases) for valid versions.
56-
In case you want to keep using `dev-main`, specify the hash of a commit to avoid running into unforseen issues like so: `dev-main#8ac7f056ef2d492b0c961da29472c27324218b83`
64+
Note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^6.0` - see [releases](https://github.com/chillerlan/php-httpinterface/releases) for valid versions.
5765

5866
Profit!
5967

@@ -65,15 +73,17 @@ as the first parameter, followed by optional `HTTPOptions` and PSR-3 `LoggerInte
6573
You can then send a request via the implemented PSR-18 method `ClientInterface::sendRequest()`,
6674
using a PSR-7 `RequestInterface` and expect a PSR-7 `ResponseInterface`.
6775

76+
6877
### `CurlClient`, `StreamClient`
6978

7079
```php
71-
$options = new HTTPOptions;
72-
$options->ca_info = '/path/to/cacert.pem';
73-
$options->user_agent = 'my cool user agent 1.0';
80+
$options = new HTTPOptions;
81+
$options->ca_info = '/path/to/cacert.pem';
82+
$options->user_agent = 'my cool user agent 1.0';
83+
$options->dns_over_https = 'https://cloudflare-dns.com/dns-query';
7484

75-
$httpClient = new CurlClient($responseFactory, $options, $logger);
76-
$request = $requestFactory->createRequest('GET', 'https://www.example.com?foo=bar');
85+
$httpClient = new CurlClient($responseFactory, $options, $logger);
86+
$request = $requestFactory->createRequest('GET', 'https://www.example.com?foo=bar');
7787

7888
$httpClient->sendRequest($request);
7989
```
@@ -88,10 +98,10 @@ It needs a `MultiResponseHandlerInterface` that parses the incoming responses, t
8898
$handler = new class () implements MultiResponseHandlerInterface{
8999

90100
public function handleResponse(
91-
ResponseInterface $response, // the incoming response
92-
RequestInterface $request, // the corresponding request
93-
int $id, // the request id
94-
array $curl_info , // the curl_getinfo() result for this request
101+
ResponseInterface $response, // the incoming response
102+
RequestInterface $request, // the corresponding request
103+
int $id, // the request id
104+
array|null $curl_info, // the curl_getinfo() result for this request
95105
):RequestInterface|null{
96106

97107
if($response->getStatusCode() !== 200){

Diff for: composer.json

-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
"require": {
2828
"php": "^8.1",
2929
"ext-curl": "*",
30-
"ext-json": "*",
31-
"ext-mbstring": "*",
32-
"ext-simplexml": "*",
33-
"ext-zlib": "*",
3430
"chillerlan/php-http-message-utils": "^2.1",
3531
"chillerlan/php-settings-container": "^3.1.1",
3632
"chillerlan/psr-7": "^1.0",

0 commit comments

Comments
 (0)