Skip to content

Conversation

@egeloen
Copy link
Contributor

@egeloen egeloen commented Sep 19, 2014

This PR is a proposal for #344.

I have removed the previous adapters but maybe we should keep and deprecate them. Let me know your feeling about it.

@willdurand
Copy link
Member

Great! Would you mind rebase your PR? So that we can review it once more before merging it :-)

@egeloen
Copy link
Contributor Author

egeloen commented Oct 3, 2014

When I have implemented this PR, I would like to keep the BC (except for the classes removed but we can still keep them in the current state) but now, I'm not sure it it is the way to go. i'm thinking to rename getContent to just get and directly return the PSR response to the provider then, it can have an access to additional informations like the headers and it will only consume the body when it is really required. What do you think?

Btw, PR rebased.

@willdurand
Copy link
Member

I'm fine with your proposal. It is ok to break BC now, but please, do it with parsimony ;-)

@willdurand willdurand changed the title Introduce egeloen/http-adapter Introduce egeloen/http-adapter (road to PSR-7) Oct 6, 2014
@willdurand willdurand added this to the 3.0.0 milestone Oct 6, 2014
@willdurand
Copy link
Member

ping @egeloen, I'd like to merge your PR. Let me know if you've time to make your minor tweaks :-)

@egeloen
Copy link
Contributor Author

egeloen commented Oct 15, 2014

@willdurand My tweaks mainly depend on what would you accept as BC break. If you think just returning the response body is enough, I think my PR is ready as it is :)

@willdurand
Copy link
Member

Relying on the interface would be nice IMHO.

@egeloen
Copy link
Contributor Author

egeloen commented Oct 15, 2014

Which interfaces are you talking about? The one from the PSR-7? Can you clarify your POV plz? :)

@willdurand
Copy link
Member

The one from the PSR-7?

yes

@egeloen
Copy link
Contributor Author

egeloen commented Oct 17, 2014

I will finish it this weekend.

@willdurand
Copy link
Member

ping @egeloen

@egeloen
Copy link
Contributor Author

egeloen commented Oct 26, 2014

Sorry, I'm late but there is some BC breaks which have been introduced in the PSR standard. I'm currently fixing them and then, I will come back here. Hope I will be able to do it today.

Btw, do you want to typehint against the RequestInterface and the ResponseInterface or just one of them? For the response, it's pretty easy to see what I need to do but for the request, I'm not sure how you would like to see it because I need to instantiate my own implementation of the request which is available through a factory. Should I introduce something like Geocoder\Adapter\HttpAdapterInterface::createRequest or I let it like it is currently (just the url).

Copy link
Member

Choose a reason for hiding this comment

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

We could remove this HttpAdapterInterface and directly rely on the Ivory one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO, removing the interface is not a good idea due to the GeoIP2Adapter which still need to implement it and typehinting the Ivory http adapter once would force me to implement a lot of methods which are not really needed for it. I can obviously typehint just this class and let the GeoIP2Adapter as it is currently or not implement any interface at all for it but it would not be consistent. What's your opinion?

Copy link
Member

Choose a reason for hiding this comment

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

This GeoIP2Adapter is not a "real" HTTP adapter anyway. Moreover, the lib under the hood has changed a lot, and first stable version is 2.0, which is not what we require right now. I suggest you to not focus on this adapter.

Introduce your lib into Geocoder, and leave the geoip2 adapter alone. I will take care of it.

@egeloen
Copy link
Contributor Author

egeloen commented Oct 27, 2014

I just push my changes.

@willdurand
Copy link
Member

Awesome!

willdurand added a commit that referenced this pull request Oct 28, 2014
Introduce egeloen/http-adapter (road to PSR-7)
@willdurand willdurand merged commit 75ac62b into geocoder-php:master Oct 28, 2014
@willdurand
Copy link
Member

@egeloen one more thing.

By default, the lib does not embed any HTTP adapters and does not install your lib, meaning it is not possible to only install Geocoder and start playing with it. I don't really know what to do, but requiring your lib sounds reasonable to me.

WDYT? ping @toin0u @Baachi et al.

@egeloen
Copy link
Contributor Author

egeloen commented Oct 28, 2014

@willdurand I know, I have not included it by default as you can use the GeoIP2Adapter and then, we don't need my lib but anyway, for easing usage, maybe we should make it mandatory.

@egeloen egeloen deleted the ivory branch October 28, 2014 09:05
@Baachi
Copy link
Member

Baachi commented Oct 28, 2014

Or we can build an geocoder.phar which include the required parts. I think it would be better for new users.

@willdurand
Copy link
Member

Not sure about the PHAR.. It would be a bit tricky for those who only know about composer install.

@Baachi
Copy link
Member

Baachi commented Oct 28, 2014

Thats true, but for users which doesn't know about composer it would be easier to use this library.

@willdurand
Copy link
Member

Could be interesting for sure, but it is not "common". I mean, Silex does that because it is a framework, PHPUnit as well, but it is not the case of libraries. Not saying it is bad, I believe this could be a nice alternative.

@Baachi
Copy link
Member

Baachi commented Oct 28, 2014

I agree, composer installation should be the prefered installation. But provide an alternative way to install geocoder would be a Nice to Have feature.

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.

4 participants