-
-
Notifications
You must be signed in to change notification settings - Fork 456
Http client adapters #50
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
This will allow users to use either Guzzle or Buzz as their HTTP client (related to #49)
/ping @cordoval, @m4tthumphrey |
wow very good work @jubianchi, let's default it to Guzzle4 of course! so that Gush dependencies start not including these others anymore. Still the php-github-api other library depends on guzzle3. But this is a very good step into that direction. 👍 |
@cordoval If possible, I would avoid requiring a default library: all supported library are added as If I choose Guzzle4, people using Buzz as their default HTTP client will then have two downloaded libs. Thoughts ? |
}, | ||
"suggest": { | ||
"kriswallsmith/buzz": "To use Buzz as the HTTP adapter (~0.7)", | ||
"guzzlehttp/guzzle": "To use Guzzle as the HTTP adapter (~3.7, ~4.1)" |
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.
you know that 3.7->3.9.* is not in guzzlehttp/guzzle but guzzle/guzzle so this should be 2 suggests
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.
@matthiasnoback book on principles of package design has some good info about avoiding these suggests i believe. But i am still working through it.
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.
cc @sstok
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.
As @matthiasnoback has already explained once There's no such thing as an optional dependency
This library cannot work work without the an actual HTTP adapter, so there are two options here.
- Pick one and just use it, make it a requirement.
- Don't ship this core-package with any adapter-implementation at all.
Create additional packages where each package provides an adapter and composer requirements for actual library.
For example: php-gitlab-api-buzz, provides the buzz http-adapter for the php-gitlab-api
core package, and its composer.json requires the php-gitlab-api and buzz-library.
So when someone requires the php-gitlab-api-buzz package, this will install the php-gitlab-api and buzz-library, and no dependencies will be missing.
This also what I have done for RollerworksSearch.
https://github.com/rollerworks/rollerworks-search-doctrine-orm/blob/master/composer.json#L19-L21
Edit. Wrong markup for the article link.
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.
@sstok thanks for the explanations :)
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.
🚧 Never link to branches 🚧
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.
Thanks for the tip, but this issue is really old 🤪 I'm no longer using Gush (or Gitlab for that matter).
I do not have the time to go through all this yet, please can you not merge it until I have gone through it. Many thanks |
I will give it another scan also, I noticed already some cs fixes |
@m4tthumphrey I won't merge this until it's clean and accepted by everyone ;) |
@jubianchi really like the adapters, has anyone tested this or written tests for it? |
Any idea of the ETA for this to be merged? It's a really nice idea, and I think the splitting out of adapters is also great! |
I also like it (not because i made the PR) because it allows the library to be more opene. But before getting this merged we have to review the implementation and also discuss how it should be integrated:
|
I would suggest having the adapters as separate packages. As I mentioned in #55, I think setting up a GitHub org is probably the way to go. This would simplify where the repos would live. |
@ls12styler to me, keeping everything in a single repo/library is not a problem. Using In fact, the library has optionnal deps. What is mandatory is having at least one of them installed. Splitting everything in several repository will force us to have a strict release process between every repo/library. So, I'm not really a big fan of splitting everything but I can understand that it could also be cool to do it but before, I think we have to define a good release process and versioning scheme. |
Whilst I (still) haven't looked too much at this (I'm sorry just really busy), I really don't want to create individual packages just for the HTTP wrapper. All we need is a simple interface which @jubianchi has already defined. Then we just include all of the implementations as single classes inside the namespace and include the |
@m4tthumphrey +1 - Sounds sensible. |
@m4tthumphrey +1. I agree with this. I think having Guzzle4 as the default would be best. |
why not use https://github.com/egeloen/ivory-http-adapter here? it already handles everything related and is able to guess the best matching adapter |
@digitalkaoz seems to be a really good alternative! 👍 |
As posted in another issue: There will not be a major new tag until the HTTP adaptor (#5, #50, #49), PHP version (#54) and PSR-4 (#55) discussions are concluded. I will also be doing a lot of house keeping over the coming days and weeks, which may include several breaking changes, mainly todo with models (#8, #10). I am not sure on the roadmap of Gitlab but envisage this to coincide with the release of 8.0 depending on @randx and co's plans. However, I will tag a smaller release to coincide with the release of 7.8 next week. |
I like the look of Ivory as it handles everything that we don't need to care about (ie Gitlab functionality only). If anyone wants to crack on with an implementation feel free. It looks like it could be done whilst preventing any breaking changes too. |
@digitalkaoz @m4tthumphrey Wow! Didn't even know about Ivory. Really nice. |
@m4tthumphrey Any progress here? If you want i can integrate HTTPlug which is a psr-7 compatible http layer which supports:
If you say yes, i can send you a PR tomorrow. (I need that for a project anyways) |
Crack on @Baachi. Probably best to create a new PR though! |
@Baachi any progress with HTTPlug? |
@sagikazarmark Hey, i started to work on it but have some problems with the listeners. |
@Baachi I dont mind if some of the API has to change to support this. The client hasn't had a major (breaking) release for a long while. |
@Baachi do you plan to finish this PR? |
@jubianchi I think you should close this in favour of #191 |
Superseeded by #191. |
This is a draft implementation of HTTP adapters solving #49.
The library now supports:
The user has to choose an adapter when creating the API client :