Skip to content

Commit d655f33

Browse files
committed
Restructure docs
1 parent 20259ae commit d655f33

File tree

4 files changed

+34
-26
lines changed

4 files changed

+34
-26
lines changed
File renamed without changes.

docs/httplug/index.md renamed to docs/httplug.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@ In both cases, the `Http\Client\HttpClient` provides a `sendRequest` method to s
99
and returns a PSR-7 `ResponseInterface`or throws an exception that implements `Http\Client\Exception`.
1010

1111
There is also the `Http\Client\HttpAsyncClient` which provides the `sendAsyncRequest` method to send
12-
a request asynchronously and returns a `Http\Client\Promise`.
12+
a request asynchronously and returns a `Http\Promise\Promise`.
1313

1414
The promise allows to specify handlers for a PSR-7 `ResponseInterface`
1515
or an exception that implements `Http\Client\Exception`.
1616

17-
18-
<p class="text-warning">
19-
Contract for the `Http\Client\Promise` is temporary until
17+
!!! warning "Warning:"
18+
Contract for the `Http\Promise\Promise` is temporary until
2019
[PSR is released](https://groups.google.com/forum/?fromgroups#!topic/php-fig/wzQWpLvNSjs).
2120
Once it is out, we will use this PSR in the main client and deprecate the old contract.
22-
</p>
2321

2422

25-
See the [tutorial](tutorial.md) for a concrete example.
23+
See the [tutorial](httplug/tutorial.md) for a concrete example.
2624

2725

2826
## HTTPlug implementations
@@ -37,7 +35,7 @@ There are two kind of implementations:
3735
- [php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation):
3836
the synchronous implementation that waits for the response / error before returning from the `sendRequest` method.
3937
- [php-http/async-client-implementation](https://packagist.org/providers/php-http/async-client-implementation):
40-
the asynchronous implementation that immediately returns a `Http\Client\Promise`,
38+
the asynchronous implementation that immediately returns a `Http\Promise\Promise`,
4139
allowing to send several requests in parallel and handling responses later.
4240

4341
Check links above for the full list of implementations.
@@ -48,7 +46,7 @@ Check links above for the full list of implementations.
4846
When writing an application, you need to require a concrete
4947
[implementation](https://packagist.org/providers/php-http/client-implementation).
5048

51-
See [virtual package](virtual-package.md) for more information on the topic of working with HTTPlug implementations.
49+
See [virtual package](httplug/virtual-package.md) for more information on the topic of working with HTTPlug implementations.
5250

5351

5452
## Installation in a reusable package
@@ -84,10 +82,10 @@ You should however always accept injecting the client instance to allow the user
8482
You can find an example in the [Discovery Component](/components/discovery) documentation.
8583

8684
Users of your package will have to select a concrete adapter in their project to make your package installable.
87-
Best point them to the [virtual package](virtual-package.md) howto page.
85+
Best point them to the [virtual package](httplug/virtual-package.md) howto page.
8886

8987
To be able to send requests, you should not depend on a specific PSR-7 implementation,
90-
but use the [Message Factory Component](/components/message-factory) system.
88+
but use the [Message Factory Component](message-factory.md) system.
9189

9290

9391
### Framework Integration
@@ -108,4 +106,4 @@ which in most cases affected every adapter as well).
108106

109107
In 2015, a decision has been made to move the library to it's own organization, so PHP HTTP was born.
110108

111-
See [migrating](migrating.md) for a guide how to migrate your code from the Ivory adapter to HTTPlug.
109+
See [migrating](httplug/migrating.md) for a guide how to migrate your code from the Ivory adapter to HTTPlug.
File renamed without changes.

docs/components/authentication.md renamed to docs/message.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Authentication
1+
# Message
22

3-
The Authentication component allows you to to implement authentication methods which can simply update the request
4-
with authentication detail (for example by adding an `Authorization` header).
5-
This is useful when you have to send multiple requests to the same endpoint. Using an authentication implementation,
6-
these details can be separated from the actual requests.
3+
This package contains various HTTP Message related tools:
4+
5+
- Authentication
6+
- Stream encoding
7+
- Message decorators
8+
- [Message factory](/message-factory) for Guzzle PSR-7 and Diactoros
9+
- Cookie
710

811

912
## Installation
@@ -12,8 +15,15 @@ these details can be separated from the actual requests.
1215
$ composer require php-http/message
1316
```
1417

18+
## Authentication
19+
20+
The Authentication component allows you to to implement authentication methods which can simply update the request
21+
with authentication detail (for example by adding an `Authorization` header).
22+
This is useful when you have to send multiple requests to the same endpoint. Using an authentication implementation,
23+
these details can be separated from the actual requests.
24+
1525

16-
## Authentication methods
26+
### Authentication methods
1727

1828
Method | Parameters | Behavior
1929
---------------- | ------------------------------------------------- | --------
@@ -28,15 +38,15 @@ Matching | An authentication instance and a matcher callback | Behavior
2838
[2]: http://www.xml.com/pub/a/2003/12/17/dive.html
2939

3040

31-
## Integration with HTTPlug
41+
### Integration with HTTPlug
3242

3343
Normally requests must be authenticated "by hand" which is not really convenient.
3444

3545
If you use HTTPlug, you can integrate this component into the client using the
3646
[authentication plugin](/httplug/plugins/authentication).
3747

3848

39-
## Examples
49+
### Examples
4050

4151
General usage looks like the following:
4252

@@ -48,7 +58,7 @@ $authentication->authenticate($request);
4858
```
4959

5060

51-
### Basic Auth
61+
#### Basic Auth
5262

5363
``` php
5464
use Http\Message\Authentication\BasicAuth;
@@ -57,7 +67,7 @@ $authentication = new BasicAuth('username', 'password');
5767
```
5868

5969

60-
### Bearer
70+
#### Bearer
6171

6272
``` php
6373
use Http\Message\Authentication\Bearer;
@@ -66,7 +76,7 @@ $authentication = new Bearer('token');
6676
```
6777

6878

69-
### WSSE
79+
#### WSSE
7080

7181
``` php
7282
use Http\Message\Authentication\Wsse;
@@ -75,7 +85,7 @@ $authentication = new Wsse('username', 'password');
7585
```
7686

7787

78-
### Query Params
88+
#### Query Params
7989

8090
`http://api.example.com/endpoint?access_token=9zh987g86fg87gh978hg9g79`
8191

@@ -94,7 +104,7 @@ $authentication = new QueryParams([
94104

95105

96106

97-
### Chain
107+
#### Chain
98108

99109
The idea behind this authentication method is that in some cases you might need to
100110
authenticate the request with multiple methods.
@@ -115,7 +125,7 @@ $authentication = new Chain($authenticationChain);
115125
```
116126

117127

118-
### Matching
128+
#### Matching
119129

120130
With this authentication method you can conditionally add authentication details to your request by passing a callable
121131
to it. When a request is passed, the callable is called and used as a boolean value in order to decide whether
@@ -152,7 +162,7 @@ $authentication = Matching::createUrlMatcher(new AuthenticationMethod(), '\/api'
152162
```
153163

154164

155-
## Implement your own
165+
### Implement your own
156166

157167
Implementing an authentication method is easy: only one method needs to be implemented.
158168

0 commit comments

Comments
 (0)