Skip to content
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

Upgrade php-http integration #257

Merged
merged 6 commits into from
Jan 4, 2016
Merged

Upgrade php-http integration #257

merged 6 commits into from
Jan 4, 2016

Conversation

dbu
Copy link
Contributor

@dbu dbu commented Dec 4, 2015

trying to adjust to the current versions of php-http.

  • Tests fail because of problem with error response conversion
  • Some TODO in the code

*
* @author David Buchmann <mail@davidbu.ch>
*/
interface HttpAdapterInterface
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if we should call this adapter, but turns out we do need some layer between the proxy client and Httplug, or we would need to duplicate logic or share it in a base class.

Choose a reason for hiding this comment

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

I agree, it should not be Http related at all. For example in FXMLRPC, http based client is just a transfer object. It could be SSH as well, but that's xmlrpc specific.

So this should be a generic interface with a naming which explains what it does (Invalidator?). The actual implementation can be Http dependent. Even if it does not make sense to invalidate without http, from an abstract point of view, it doesn't matter.

@@ -276,6 +285,5 @@ Varnish client::
Make sure to add any headers that you want to ban on to your
:doc:`proxy configuration <proxy-configuration>`.

.. _header: http://php.net/header
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i did not see this being used anywhere in the doc.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@dbu
Copy link
Contributor Author

dbu commented Dec 7, 2015

@sagikazarmark when looking at the travis fails, i think we have a problem with the guzzle6 adapter. created php-http/guzzle6-adapter#13 to discuss that further

$exceptions = new ExceptionCollection();

foreach ($queue as $request) {
foreach ($this->multiplex($request) as $proxyRequest) {
Copy link
Member

Choose a reason for hiding this comment

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

I’m not sure ‘multiplex’ is the right terminology. Perhaps what you mean is inverse multiplexing? Unfortunately, that sounds a little convoluted, so perhaps just fanOut() or something would be better? Anyway, you’re the networking expert. 😉

Copy link
Contributor Author

@dbu dbu Dec 8, 2015 via email

Choose a reason for hiding this comment

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

@dbu
Copy link
Contributor Author

dbu commented Dec 22, 2015

the guzzle setup has been fixed: php-http/guzzle6-adapter#19

@ddeboer
Copy link
Member

ddeboer commented Dec 29, 2015

This is green for guzzle6-adapter now. Fixing guzzle5-adapter installation in php-http/guzzle5-adapter#9.

- if [[ "$TRAVIS_PHP_VERSION" == "5.4" || "$TRAVIS_PHP_VERSION" == "hhvm" ]]; then composer remove "php-http/guzzle6-adapter" --dev --no-update; fi
- if [[ "$TRAVIS_PHP_VERSION" == "5.4" || "$TRAVIS_PHP_VERSION" == "hhvm" ]]; then composer require "php-http/guzzle5-adapter" --dev --no-update; fi
- if [[ "$TRAVIS_PHP_VERSION" == "5.4" ]]; then composer remove "php-http/guzzle6-adapter" --dev --no-update; fi
- if [[ "$TRAVIS_PHP_VERSION" == "5.4" ]]; then composer require "php-http/guzzle5-adapter" --dev --no-update; fi
Copy link
Member

Choose a reason for hiding this comment

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

Guzzle 6 now correctly runs on hhvm, yay!

@ddeboer
Copy link
Member

ddeboer commented Dec 30, 2015

Okay, everything is now green except PHP 5.4. This is caused by the current php-http/guzzle5-adapter not offering async. We could fix this, of course, but I’d actually opt for dropping 5.4 support: it’s been EOL for quite some time, and big ones like Symfony 3.0 don’t support it any longer either. If we drop 5.4, we don’t have to test against Guzzle 5 anymore.

@dbu Do you agree?

@dbu
Copy link
Contributor Author

dbu commented Dec 31, 2015 via email

@ddeboer ddeboer force-pushed the adjust-php-http branch 9 times, most recently from 216eeb1 to 7aa8e47 Compare January 1, 2016 16:33
@ddeboer ddeboer changed the title WIP: upgrade php-http integration Upgrade php-http integration Jan 1, 2016
"php-http/client-implementation": "^1.0.0",
"php-http/discovery": "^0.6.0",
"php-http/message": "^0.2.1",
"puli/cli": "^1.0.0-beta8"
Copy link
Member

Choose a reason for hiding this comment

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

Adding Puli as a dependency so php-http/discovery works out of the box.

Choose a reason for hiding this comment

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

I would rather add this as a development dependency and document that Puli is necessary. At least it seemed to me as a recommendation from Puli. Maybe @webmozart could help in in this question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and puli is only required when not injecting a http client explicitly. maybe we should move discovery to optional. does discovery only work with puli but not require it? that would feel wrong to me.

Copy link
Member

Choose a reason for hiding this comment

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

@dbu Yes, Discovery should be optional with FOSHttpCache. We can make it so in two ways:

  1. just move it from require to suggest and document it properly; and maybe add conditional checks around the Discovery calls in our code
  2. remove all Discovery calls from our code and document that users should either pass an HTTP client explicitly or do the discovery in their own code.

My beef with 2 and @sagikazarmark’s idea to have users install Puli is that it becomes a lot more work for users to get started with FOSHttpCache.

For discovery’s Puli dependency, see php-http/discovery#36.

Choose a reason for hiding this comment

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

No, Puli is not optional. All the relevant Puli dependencies are required in the discover package. The cli is something that is up to the user: it can be installed as a phar globally in the prefix, or installed with composer in the application.

I guess there is nothing wrong in adding it as a dependency here. But I guess some time in the future having puli.phar in the users prefix will be as common as composer.

Copy link
Member

Choose a reason for hiding this comment

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

@dbu No problem. 😉

How will we then handle Discovery here?

  • either we require it, no questions asked
  • or we suggest it and add a note to our docs.

Choose a reason for hiding this comment

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

no questions asked 😄

Choose a reason for hiding this comment

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

Ah, sorry, missed the question, I thought it's still discovery-puli.

Copy link
Contributor Author

@dbu dbu Jan 3, 2016 via email

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ddeboer
Copy link
Member

ddeboer commented Jan 1, 2016

We have a green Travis build. Scrutinizer still fails but I’d like to fix that on a separate PR. Squashed commits, so this is ready for merging.

"require": {
"php": ">=5.4.8",
"php": ">=5.5.9",
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick, but could be ^5.5.9|^7.0 to be more explicit on future versions.

Copy link
Member

Choose a reason for hiding this comment

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

Good point, it seems to becoming the standard now.

"php-http/discovery": "^0.1.1",
"php-http/message-decorator": "^0.1.0"
"php-http/client-implementation": "^1.0.0",
"php-http/discovery": "^0.6.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the discovery is not usable without running a puli cli command or adding that command to the project's post-install commands in composer, does it make sense to require the discovery at all? or should we just document how to use discovery and puli for 0-config when wanted?

Choose a reason for hiding this comment

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

That's what I would like to achieve: php-http/discovery#33

dbu added a commit that referenced this pull request Jan 4, 2016
@dbu dbu merged commit f976903 into master Jan 4, 2016
@dbu dbu deleted the adjust-php-http branch January 4, 2016 10:40
@dbu
Copy link
Contributor Author

dbu commented Jan 4, 2016

yay!

lets continue to tweak things, but i wanted to merge now as this PR was getting rather large

@sagikazarmark
Copy link

Discovery 0.6.2 tagged

@ddeboer
Copy link
Member

ddeboer commented Jan 4, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants