Skip to content

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

Merged
merged 1 commit into from
Nov 6, 2015
Merged

building the initial bundle #8

merged 1 commit into from
Nov 6, 2015

Conversation

dbu
Copy link
Collaborator

@dbu dbu commented Oct 17, 2015

continued from #6
fix #7

once merged, we can move this repo to the php-http organisation.

@dbu
Copy link
Collaborator Author

dbu commented Oct 17, 2015

@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",
Copy link
Collaborator Author

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?

Copy link
Member

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.

Copy link
Collaborator Author

@dbu dbu Oct 19, 2015 via email

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

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

@sagikazarmark
Copy link
Member

I see Vendor\Bundle\NamedBundle regularly. Is it a common pattern? If so , what do you think about it?

Regarding naming: I trust in your choice as you have more experience in it.

@@ -0,0 +1,73 @@
<?php

namespace Http\ClientBundle\DependencyInjection;
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this HttplugBundle?

@dbu
Copy link
Collaborator Author

dbu commented Oct 18, 2015

I see Vendor\Bundle\NamedBundle regularly. Is it a common pattern? If so, what do you think about it?

the Bundle bit is optional. what is our vendor name? Http? or PhpHttp? i
looked at the httplug code and there its still Http/Client so i went with
that. do we keep the httplug namespace like that?

@sagikazarmark
Copy link
Member

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`
Copy link
Collaborator Author

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

and fine as well.

@dbu
Copy link
Collaborator Author

dbu commented Oct 29, 2015

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?

@sagikazarmark
Copy link
Member

I think guzzle implements the latest-greatest httplug, thanks to @joelwurtz.

@sagikazarmark
Copy link
Member

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)

@dbu
Copy link
Collaborator Author

dbu commented Oct 30, 2015 via email

@sagikazarmark
Copy link
Member

that this service name is the default.

Like that, I was thinking about the same.

the bundle can not really help with setting up specific clients

Actually, I think that specific clients should be configured through their own bundle and then the configured service should be passed to the adapter.

i also plan to add services for the utils clients (Batch, Methods)

👍

message_factory: httplug.message_factory.default
uri_factory: httplug.uri_factory.default
classes:
client: ~ # uses discovery if not specified
Copy link
Member

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.

Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

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.

@dbu
Copy link
Collaborator Author

dbu commented Nov 5, 2015

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?

@sagikazarmark
Copy link
Member

Nope, go ahead.

dbu added a commit that referenced this pull request Nov 6, 2015
building the initial bundle
@dbu dbu merged commit 2a388f8 into master Nov 6, 2015
@dbu dbu deleted the initial-bundle branch November 6, 2015 07:49
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.

Httplug
4 participants