Skip to content

Commit 47ff3b3

Browse files
committed
:octocat:
1 parent 5b31b31 commit 47ff3b3

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

Diff for: README.md

+35-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ A collection of framework-agnostic utilities for use with [PSR-7 Message impleme
3737

3838
**requires [composer](https://getcomposer.org)**
3939

40-
`composer.json` (note: replace `dev-main` with a [version boundary](https://getcomposer.org/doc/articles/versions.md), e.g. `^2.1`)
40+
`composer.json` (note: replace `dev-main` with a [version boundary](https://getcomposer.org/doc/articles/versions.md), e.g. `^2.2`)
4141
```json
4242
{
4343
"require": {
@@ -48,6 +48,7 @@ A collection of framework-agnostic utilities for use with [PSR-7 Message impleme
4848
```
4949
Profit!
5050

51+
5152
## Usage
5253

5354
### `URLExtractor`
@@ -72,10 +73,10 @@ $request = $factory->createRequest('GET', 'https://t.co/ZSS6nVOcVp');
7273
$urlExtractor->sendRequest($request); // -> response from the final location
7374

7475
// you can retrieve an array with all followed locations afterwards
75-
$responses = $this->http->getResponses(); // -> ResponseInterface[]
76+
$responses = $urlExtractor->getResponses(); // -> ResponseInterface[]
7677

7778
// if you just want the URL of the final location, you can use the extract method:
78-
$url = $this->http->extract('https://t.co/ZSS6nVOcVp'); // -> https://api.guildwars2.com/v2/build
79+
$url = $urlExtractor->extract('https://t.co/ZSS6nVOcVp'); // -> https://api.guildwars2.com/v2/build
7980
```
8081

8182
### `EchoClient`
@@ -118,6 +119,37 @@ $loggingClient = new LoggingClient($httpClient, $logger);
118119
$loggingClient->sendRequest($request); // -> log to output given via logger
119120
```
120121

122+
The output looks similar to the following (using [monolog](https://github.com/Seldaek/monolog)):
123+
124+
```
125+
[2024-03-15 22:10:41][debug] LoggingClientTest:
126+
----HTTP-REQUEST----
127+
GET /get HTTP/1.1
128+
Host: httpbin.org
129+
130+
131+
[2024-03-15 22:10:41][debug] LoggingClientTest:
132+
----HTTP-RESPONSE---
133+
HTTP/1.1 200 OK
134+
Date: Fri, 15 Mar 2024 21:10:40 GMT
135+
Content-Type: application/json
136+
Content-Length: 294
137+
Connection: keep-alive
138+
Server: gunicorn/19.9.0
139+
Access-Control-Allow-Origin: *
140+
Access-Control-Allow-Credentials: true
141+
142+
{
143+
"args": {},
144+
"headers": {
145+
"Host": "httpbin.org",
146+
"User-Agent": "chillerlanPHPUnitHttp/1.0.0 +https://github.com/chillerlan/phpunit-http",
147+
"X-Amzn-Trace-Id": "Root=1-65f4b950-1f87b9e37182673438091aea"
148+
},
149+
"origin": "93.236.207.163",
150+
"url": "https://httpbin.org/get"
151+
}
152+
```
121153

122154

123155
## API

0 commit comments

Comments
 (0)