Skip to content

Replace plugins package with client-common #72

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 2 commits into from
May 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- Guzzle 6 client is now created according to the Httplug specifications with automated minimal behaviour.
Make sure you configure the Httplug plugins as needed,
for example if you want to get exceptions for failure HTTP status codes.
- **[BC] PluginClientFactory returns an instance of `Http\Client\Common\PluginClient`** (see [php-http/client-common#14](https://github.com/php-http/client-common/pull/14))
- Plugins are loaded from their new packages

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we say that version 2 of the bundle will not automatically require the plugins that moved to separate repositories? i am not sure if we want to do that actually - cache, logger and stopwatch all depend on things that symfony depends on anyways, so there is no cost in requiring them in the bundle, right? maybe we even want to explicitly require those new plugins rather than the BC repository.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with that as well. In that case, we don't need to rely on the old package.


### Fixed
Expand Down
4 changes: 2 additions & 2 deletions ClientFactory/PluginClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Http\HttplugBundle\ClientFactory;

use Http\Client\Plugin\Plugin;
use Http\Client\Plugin\PluginClient;
use Http\Client\Common\Plugin;
use Http\Client\Common\PluginClient;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is technically a BC break - if somebody typehinted the old plugin client, things will fail. but i think thats really an edge case, just mention it in the changelog.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, you are right. However I think it is a design mistake to rely on the plugin client: one's code should work with any kind of http client.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to changelog


/**
* This factory creates a PluginClient.
Expand Down
2 changes: 1 addition & 1 deletion Collector/MessageJournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Http\HttplugBundle\Collector;

use Http\Client\Exception;
use Http\Client\Plugin\Journal;
use Http\Client\Common\Plugin\Journal;
use Http\Message\Formatter;
use Http\Message\Formatter\SimpleFormatter;
use Psr\Http\Message\RequestInterface;
Expand Down
5 changes: 3 additions & 2 deletions DependencyInjection/HttplugExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Http\HttplugBundle\DependencyInjection;

use Http\Client\Plugin\AuthenticationPlugin;
use Http\Client\Plugin\PluginClient;
use Http\Client\Common\Plugin\AuthenticationPlugin;
use Http\Client\Common\PluginClient;
use Http\HttplugBundle\ClientFactory\DummyClient;
use Http\Message\Authentication\BasicAuth;
use Http\Message\Authentication\Bearer;
Expand Down Expand Up @@ -119,6 +119,7 @@ private function configurePlugins(ContainerBuilder $container, array $config)

foreach ($config as $name => $pluginConfig) {
$pluginId = 'httplug.plugin.'.$name;

if ($pluginConfig['enabled']) {
$def = $container->getDefinition($pluginId);
$this->configurePluginByName($name, $def, $pluginConfig);
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/data-collector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<argument>null</argument>
</service>

<service id="httplug.collector.history_plugin" class="Http\Client\Plugin\HistoryPlugin" public="false">
<service id="httplug.collector.history_plugin" class="Http\Client\Common\Plugin\HistoryPlugin" public="false">
<argument type="service" id="httplug.collector.message_journal"/>
</service>
</services>
Expand Down
20 changes: 10 additions & 10 deletions Resources/config/plugins.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="httplug.plugin.cache" class="Http\Client\Plugin\CachePlugin" public="false">
<service id="httplug.plugin.cache" class="Http\Client\Common\Plugin\CachePlugin" public="false">
<argument />
<argument />
<argument />
</service>
<service id="httplug.plugin.content_length" class="Http\Client\Plugin\ContentLengthPlugin" public="false" />
<service id="httplug.plugin.cookie" class="Http\Client\Plugin\CookiePlugin" public="false">
<service id="httplug.plugin.content_length" class="Http\Client\Common\Plugin\ContentLengthPlugin" public="false" />
<service id="httplug.plugin.cookie" class="Http\Client\Common\Plugin\CookiePlugin" public="false">
<argument />
</service>
<service id="httplug.plugin.decoder" class="Http\Client\Plugin\DecoderPlugin" public="false" />
<service id="httplug.plugin.error" class="Http\Client\Plugin\ErrorPlugin" public="false" />
<service id="httplug.plugin.history" class="Http\Client\Plugin\HistoryPlugin" public="false">
<service id="httplug.plugin.decoder" class="Http\Client\Common\Plugin\DecoderPlugin" public="false" />
<service id="httplug.plugin.error" class="Http\Client\Common\Plugin\ErrorPlugin" public="false" />
<service id="httplug.plugin.history" class="Http\Client\Common\Plugin\HistoryPlugin" public="false">
<argument />
</service>
<service id="httplug.plugin.logger" class="Http\Client\Plugin\LoggerPlugin" public="false">
<service id="httplug.plugin.logger" class="Http\Client\Common\Plugin\LoggerPlugin" public="false">
<argument />
<argument>null</argument>
</service>
<service id="httplug.plugin.redirect" class="Http\Client\Plugin\RedirectPlugin" public="false" />
<service id="httplug.plugin.retry" class="Http\Client\Plugin\RetryPlugin" public="false" />
<service id="httplug.plugin.stopwatch" class="Http\Client\Plugin\StopwatchPlugin" public="false">
<service id="httplug.plugin.redirect" class="Http\Client\Common\Plugin\RedirectPlugin" public="false" />
<service id="httplug.plugin.retry" class="Http\Client\Common\Plugin\RetryPlugin" public="false" />
<service id="httplug.plugin.stopwatch" class="Http\Client\Common\Plugin\StopwatchPlugin" public="false">
<argument />
</service>
</services>
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"php": ">=5.5",
"php-http/client-implementation": "^1.0",
"php-http/message-factory": "^1.0.2",
"php-http/plugins": "^1.0",
"php-http/client-common": "^1.1",
"php-http/cache-plugin": "^1.0",
"php-http/logger-plugin": "^1.0",
"php-http/stopwatch-plugin": "^1.0",
"symfony/options-resolver": "^2.7|^3.0",
"symfony/framework-bundle": "^2.7|^3.0"
},
Expand Down