Skip to content

Commit

Permalink
Merge pull request #58 from php-http/doc-stubs
Browse files Browse the repository at this point in the history
Add complete TOC and stubs
  • Loading branch information
ddeboer committed Jan 2, 2016
2 parents 5946c4b + 6904910 commit 33c4aab
Show file tree
Hide file tree
Showing 28 changed files with 110 additions and 22 deletions.
1 change: 1 addition & 0 deletions docs/clients/curl-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CURL Client
1 change: 1 addition & 0 deletions docs/clients/guzzle5-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Guzzle5 Adapter
1 change: 1 addition & 0 deletions docs/clients/guzzle6-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Guzzle6 Adapter
6 changes: 6 additions & 0 deletions docs/clients/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Clients & Adapters

There are clients implementing one of the HTTPlug interfaces directly,
and adapter packages that implement the interface and forward the calls to HTTP clients not implementing the interface.

TODO
1 change: 1 addition & 0 deletions docs/clients/mock-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Mock Client
1 change: 1 addition & 0 deletions docs/clients/react-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# React Adapter
1 change: 1 addition & 0 deletions docs/clients/socket-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Socket Client
3 changes: 3 additions & 0 deletions docs/components/adapter-integration-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Adapter Integration Tests

TODO
5 changes: 3 additions & 2 deletions docs/httplug/utils.md → docs/components/client-common.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Utilities
# Client Common

The utilities package provides some useful tools for working with HTTPlug. Include them in your project with composer:
The client-common package provides some useful tools for working with HTTPlug.
Include them in your project with composer:

``` bash
composer require "php-http/utils" "^1.0"
Expand Down
34 changes: 22 additions & 12 deletions docs/components/authentication.md → docs/components/message.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# Authentication
# Message

This package contains various PSR-7 tools which might be useful in an HTTP workflow:

* Authentication method implementations
* Various Stream encoding tools
* Message decorators
* Message factory implementations for Guzzle PSR-7 and Diactoros
* Cookie implementation

## Authentication

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


## Installation
### Installation

```
$ composer require php-http/message
```


## Authentication methods
### Authentication methods

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


## Integration with HTTPlug
### Integration with HTTPlug

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

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


## Examples
### Examples

General usage looks like the following:

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


### Basic Auth
#### Basic Auth

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


### Bearer
#### Bearer

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


### WSSE
#### WSSE

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


### Query Params
#### Query Params

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

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



### Chain
#### Chain

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


### Matching
#### Matching

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


## Implement your own
### Implement your own

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

Expand Down
5 changes: 5 additions & 0 deletions docs/components/promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Promise

Promise used for asynchronous HTTP requests.

This will eventually be removed/deprecated and replaced with the upcoming Promise PSR.
6 changes: 3 additions & 3 deletions docs/httplug/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The monolithic ivory package has been separated into several smaller, more speci
Instead of `Ivory\HttpAdapter\PsrHttpAdapter`, use `Http\Client\HttpClient`.
The HttpClient simply has a method to send requests.

If you used the `Ivory\HttpAdapter\HttpAdapter`, have a look at the [Utilities](utils.md)
If you used the `Ivory\HttpAdapter\HttpAdapter`, have a look at [client-common](../components/client-common.md)
and use the `Http\Client\Utils\HttpMethodsClient` which wraps any HttpClient and provides the convenience methods
to send requests without creating RequestInterface instances.

Expand All @@ -22,9 +22,9 @@ Replace usage of `GuzzleHttp\ClientInterface` with `Http\Client\HttpClient`.
The `send` method is called `sendRequest`.
Instead of the `$options` argument, configure the client appropriately during set up.
If you need different settings, create different instances of the client.
You can use [plugins](plugins.md) to further tune your client.
You can use [plugins](../plugins/index.md) to further tune your client.

If you used the `request` method, have a look at the [Utilities](utils.md) and
If you used the `request` method, have a look at [client-common](../components/client-common.md) and
use the `Http\Client\Utils\HttpMethodsClient` which wraps any HttpClient and provides the convenience methods
to send requests without creating RequestInterface instances.

Expand Down
3 changes: 0 additions & 3 deletions docs/httplug/plugins/encoding.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ $pluginClient = new PluginClient(
);
```

Check the [authentication component documentation](http://docs.httplug.io/en/latest/components/authentication/)
Check the [authentication component documentation](../components/message.md#authentication)
for the list of available authentication methods.
3 changes: 3 additions & 0 deletions docs/plugins/cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Cache Plugin

TODO
3 changes: 3 additions & 0 deletions docs/plugins/content-length.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Content-Length Plugin

TODO
File renamed without changes.
3 changes: 3 additions & 0 deletions docs/plugins/decoder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Decoder Plugin

TODO
File renamed without changes.
3 changes: 3 additions & 0 deletions docs/plugins/history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# History Plugin

TODO: explain the error plugin
2 changes: 1 addition & 1 deletion docs/httplug/plugins.md → docs/plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,5 @@ the core as small as possible with the most widely used plugin implementations.

Even if we think that a plugin is not suitable for the core, we want to help you sharing your work with the community.
You can always open a Pull Request to place a link and a small description of your plugin on the
[Third Party Plugins](plugins/third-party-plugins.md) page. In special cases,
[Third Party Plugins](third-party-plugins.md) page. In special cases,
we might offer you to host your package under the PHP HTTP namespace.
3 changes: 3 additions & 0 deletions docs/plugins/journal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Journal

TODO
3 changes: 3 additions & 0 deletions docs/plugins/logger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Logger Plugin

TODO
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,45 @@ markdown_extensions:
permalink: true
- sane_lists
- admonition

pages:
- Home: index.md
- HTTPlug:
- httplug/index.md
- httplug/migrating.md
- httplug/tutorial.md
- httplug/virtual-package.md
- Components:
- 'Clients & Adapters':
- Introduction: clients/index.md
- clients/curl-client.md
- clients/mock-client.md
- clients/socket-client.md
- clients/guzzle5-adapter.md
- clients/guzzle6-adapter.md
- clients/react-adapter.md
- Plugins:
- plugins/index.md
- plugins/authentication.md
- plugins/cache.md
- plugins/content-length.md
- plugins/cookie.md
- plugins/decoder.md
- plugins/error.md
- plugins/history.md
- plugins/journal.md
- plugins/logger.md
- plugins/redirect.md
- plugins/retry.md
- plugins/stopwatch.md
- plugins/third-party-plugins.md
- components/message.md
- Other Components:
- components/client-common.md
- components/discovery.md
- components/message-factory.md
- components/promise.md
- Development:
- development/code-of-conduct.md
- development/contributing.md
- development/license.md

0 comments on commit 33c4aab

Please sign in to comment.