-
Notifications
You must be signed in to change notification settings - Fork 56
Update plugin documentation #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.row-even .line-block, .row-odd .line-block { | ||
margin-left: 0; | ||
} | ||
|
||
.versionmodified { | ||
font-weight: bold; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,19 @@ Introduction | |
Install | ||
------- | ||
|
||
Install the plugin client in your project with Composer_: | ||
The plugin client and the core plugins are available in the `php-http/client-common`_ package: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think here would be the other place to have versionadded and say that this is only the case since 1.1 and for 1.0 you need to require php-http/plugins. |
||
|
||
.. code-block:: bash | ||
|
||
$ composer require php-http/plugins | ||
$ composer require php-http/client-common | ||
|
||
.. _php-http/client-common: https://github.com/php-http/client-common | ||
|
||
.. versionadded:: 1.1 | ||
The plugins were moved to the clients-common package in version 1.1. | ||
If you work with version 1.0, you need to require the separate `php-http/plugins` package | ||
and the namespace is ``Http\Client\Plugin`` instead of ``Http\Client\Common`` | ||
|
||
|
||
How it works | ||
------------ | ||
|
@@ -24,9 +32,9 @@ The Plugin Client accepts an HTTP Client implementation and an array of plugins. | |
Let’s see an example:: | ||
|
||
use Http\Discovery\HttpClientDiscovery; | ||
use Http\Client\Plugin\PluginClient; | ||
use Http\Client\Plugin\RetryPlugin; | ||
use Http\Client\Plugin\RedirectPlugin; | ||
use Http\Client\Common\PluginClient; | ||
use Http\Client\Common\Plugin\RetryPlugin; | ||
use Http\Client\Common\Plugin\RedirectPlugin; | ||
|
||
$retryPlugin = new RetryPlugin(); | ||
$redirectPlugin = new RedirectPlugin(); | ||
|
@@ -99,6 +107,8 @@ plugins or configure a different client. For example:: | |
$myApiClient = new My\Api\Client('https://api.example.org', My\Api\HttpClientFactory::create('john', 's3cr3t')); | ||
|
||
use Http\Client\HttpClient; | ||
use Http\Client\Common\Plugin\AuthenticationPlugin; | ||
use Http\Client\Common\Plugin\ErrorPlugin; | ||
use Http\Discovery\HttpClientDiscovery; | ||
|
||
class HttpClientFactory | ||
|
@@ -118,7 +128,7 @@ plugins or configure a different client. For example:: | |
$client = HttpClientDiscovery::find(); | ||
} | ||
return new PluginClient($client, [ | ||
new Http\Client\Plugin\ErrorPlugin(), | ||
new ErrorPlugin(), | ||
new AuthenticationPlugin( | ||
// This API has it own authentication algorithm | ||
new ApiAuthentication(Client::AUTH_OAUTH_TOKEN, $user, $pass) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will only be correct once we have released 1.1 right? we might want to add a
versionadded
block in strategically relevant places to explain what was changed in 1.1There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
versionadded
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what would be the format? Since from the documentation point of view we haven't added anything, but changed. Would it be "Since client-common 1.1 Plugins are part of that package" or "Prior to client-common 1.1 it was a separate package"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I will add it.
One more though: we probably have to always mention the package as well, since the versioning is not aligned between repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, good point. so lets be even more explicit and say something like
The plugins where moved to the clients-common package in version 1.1. If
you work with version 1.0, you need to require the separate plugin
package. The new interface will keep implementing
Http\Client\Plugin\Plugin
until version 2 but relying on the oldinterface is deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this is not true, and even if it was, it should be the other way around IMO: the old interface should extend the new one.