-
Notifications
You must be signed in to change notification settings - Fork 60
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
Conversation
* | ||
* @author David Buchmann <mail@davidbu.ch> | ||
*/ | ||
interface HttpAdapterInterface |
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.
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.
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 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 |
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 did not see this being used anywhere in the doc.
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.
👍
@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) { |
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’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. 😉
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.
the guzzle setup has been fixed: php-http/guzzle6-adapter#19 |
561af35
to
bc2d405
Compare
This is green for guzzle6-adapter now. Fixing guzzle5-adapter installation in php-http/guzzle5-adapter#9. |
049381b
to
b97f000
Compare
- 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 |
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.
Guzzle 6 now correctly runs on hhvm, yay!
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? |
yup, sounds good. lets ditch 5.4 and go for 5.5. we are talking version
2.0 so lets not burden us with things that are already legacy.
|
e5244d8
to
1f1f01d
Compare
216eeb1
to
7aa8e47
Compare
convert to options array
7aa8e47
to
7486bfa
Compare
Fix Symfony 2.3-incompatible calls
7486bfa
to
03c331a
Compare
"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" |
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.
Adding Puli as a dependency so php-http/discovery works out of the box.
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 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.
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 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.
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.
@dbu Yes, Discovery should be optional with FOSHttpCache. We can make it so in two ways:
- just move it from
require
tosuggest
and document it properly; and maybe add conditional checks around the Discovery calls in our code - 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.
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.
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.
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.
@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.
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.
no questions asked 😄
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.
Ah, sorry, missed the question, I thought it's still discovery-puli.
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.
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", |
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.
nitpick, but could be ^5.5.9|^7.0
to be more explicit on future versions.
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.
Good point, it seems to becoming the standard now.
03c331a
to
2459eb1
Compare
"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", |
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.
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?
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.
That's what I would like to achieve: php-http/discovery#33
yay! lets continue to tweak things, but i wanted to merge now as this PR was getting rather large |
Discovery 0.6.2 tagged |
👍 |
trying to adjust to the current versions of php-http.