Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Nov 11, 2015
1 parent 25fa2b5 commit 2f2b210
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/plugins.md
@@ -1,8 +1,8 @@
# Plugin System

The plugin system allow to manipulate requests and responses inside a `HttpClient`.
The plugin system allow to manipulate requests and responses inside an `HttpClient`.

By using the `Http\Client\Plugin\PluginClient` you can inject a `HttpClient` or a `HttpAsyncClient`, and an array
By using the `Http\Client\Plugin\PluginClient` you can inject an `HttpClient` or an `HttpAsyncClient`, and an array
of plugins implementing the `Http\Client\Plugin\Plugin` interface.

Each plugin can modify the `RequestInterface` sent or the `ResponseInterface` received. It can also change the behavior of a call
Expand Down Expand Up @@ -52,7 +52,7 @@ $response = $pluginClient->sendRequest($request);
$promise = $pluginClient->sendAsyncRequest($request);
```

Read the [tutorial](tutorial.md) to know more about `HttpClient` and `HttpAsyncClient`
GO to the [tutorial](tutorial.md) to read more about using `HttpClient` and `HttpAsyncClient`

## Available plugins

Expand Down Expand Up @@ -102,10 +102,10 @@ Response <--- PluginClient <--- RetryPlugin <--- RedirectPlugin <--- HttpClient
In order to have correct behavior over the global process, you need to understand well each plugin used,
and manage a correct order when passing the array to the `PluginClient`

`RetryPlugin` will be best at then for example if you want to optimize the retry process, but also it can be good
to have it in the first plugin, if one is inconsistent and may need a retry.
`RetryPlugin` will be best at the end to optimize the retry process, but it can also be good
to have it as the first plugin, if one in the chain is inconsistent and may need a retry.

Our recommendation, which apply to most of the use case, is to organize your plugins with the following rule:
Our recommendation, which apply to most of use cases, is to organize your plugins with following rules:

1. Plugins that modify the request should be at the beginning (like the `AuthenticationPlugin` or the `CookiePlugin`)
2. Plugins which intervene in the workflow should be in the "middle" (like the `RetryPlugin` or the `RedirectPlugin`)
Expand Down Expand Up @@ -180,7 +180,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
In this example the condition is not superfluous, you need to have some way to not calling the $first callable each time or
you will end up with a infinite execution loop.

The `$next` and `$first` callable will return a `Promise`, you can manipulate the `ResponseInterface` or the `Exception`
The `$next` and `$first` callable will return a `Promise`. You can manipulate the `ResponseInterface` or the `Exception`
by using the `then` method of the promise.

```
Expand All @@ -199,4 +199,4 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
```

Anyway it is always a good practice to read existing implementation inside the [plugin repository](https://github.com/php-http/plugins) to better understand the whole
process;
process.

0 comments on commit 2f2b210

Please sign in to comment.