-
Notifications
You must be signed in to change notification settings - Fork 50
building the initial bundle #8
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
Conversation
@sagikazarmark can you review again? i think i adressed all your concerns raised in #6. also doing the rename. what should the main namespace be? currently its Http/HttplugBundle. is that ok? |
"require": { | ||
"php-http/discovery": "^0.1.1", | ||
"php-http/httplug": "^0.1.0", | ||
"php-http/httplug-implementation": "^0.1.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.
are these namespaces correct? or what will the virtual package be?
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 discussed naming in php-http/httplug#68. I would prefer those two, but I am open to suggestions.
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 have to wait for our decision on php-http/httplug#68 (comment) until i can adapt this
I see Regarding naming: I trust in your choice as you have more experience in it. |
@@ -0,0 +1,73 @@ | |||
<?php | |||
|
|||
namespace Http\ClientBundle\DependencyInjection; |
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.
Isn't this HttplugBundle?
the Bundle bit is optional. what is our vendor name? Http? or PhpHttp? i |
Okay, we can skip the Bundle in the namepace. Honestly, I am not sure about naming. We kept Http\Client for the httplug package. Not sure about that either, but I think the bundle could be HttplugBundle regardless of what the package namespace is. |
|
||
This bundle provides 3 services: | ||
|
||
* `httplug.client` a service that provides the `Http\Client\HttpClient` |
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.
depending on the decision on php-http/httplug#68 (comment) this might need to be changed
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 fine as well.
updated. will have to check whether i can install it and all that, then would be ready to transfer to the php-http organisation. also need to see about tests that make sure we are in sync with all parts of php-http. what is the state of the guzzle adapter? |
I think guzzle implements the latest-greatest httplug, thanks to @joelwurtz. |
Will it be possible to configure multiple clients? Also, can we configure Guzzle Client for example prior to passing it to the adapter? (I guess it has to be done in services somehow) |
Will it be possible to configure multiple clients?
this is certainly something we will want to make possible, but right now
the bundle does not help with that.
Also, can we
configure Guzzle Client for example prior to passing it to the adapter?
(I guess it has to be done in services somehow)
the bundle does not know about specific adapters. the idea for that use
case would be that you simply configure guzzle and the adapter as
services in your application and tell the bundle that this service name
is the default.
with httplug being just the contract, the bundle can not really help
with setting up specific clients. where it will really shine however is
when we have the plugin system in place. then we can allow to configure
pipelines.
i also plan to add services for the utils clients (Batch, Methods). but
not in this PR, first get the MVP done.
|
Like that, I was thinking about the same.
Actually, I think that specific clients should be configured through their own bundle and then the configured service should be passed to the adapter.
👍 |
message_factory: httplug.message_factory.default | ||
uri_factory: httplug.uri_factory.default | ||
classes: | ||
client: ~ # uses discovery if not specified |
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.
Hum, maybe we can have a class for each adapter which can inject/send a NodeConfiguration ? So we would now how to configure each adapter.
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 think it should be done in service configuration by the user.
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 user can specify a class for the client / adapter and we just
instantiate that class without arguments. in a first step, i would
expect the user to define a service for their adapter if they need
specific configuration on their client/adapter.
the next step will be to allow to configure plugins and wrapper clients.
i want to avoid configuring the actual guzzle client, but if the
guzzle adapter has specific configuration, we can add that at some
point. not sure how much specific configuration the adapters will have
however.
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 how much specific configuration the adapters will have however.
Shouldn't be any at all.
Is it possible to specify adapter classes as services, so we can configure the underlying client?
For example create a service for Guzzle6Adapter where a Guzzle Client instance is being injected which can be cpnfigured as a service as well.
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.
Is it possible to specify adapter classes as services
that seems too complicated to me. either use the factory or simply define a service for the underlying client and another one for the adapter, then configure this bundle to use your service.
i updated the readme to better explain the idea.
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.
simply define a service for the underlying client and another one for the adapter, then configure this bundle to use your service.
That's exactly what I want.
i think this is ready for an initial version. note that the bundle does not do much more than providing the autowiring as a symfony service - but with the option to specify a manually created service instead. once plugins are defined, we should work on that. and also provide convenient ways to get the HttpMethodsClient, BatchClient and AsyncClient as services. any objections if i merge this and move it to the php-http organisation? |
Nope, go ahead. |
continued from #6
fix #7
once merged, we can move this repo to the php-http organisation.