Skip to content

Decouple from Guzzle - #389

Merged
cursedcoder merged 1 commit into
KnpLabs:masterfrom
Nyholm:httplug
Jul 27, 2016
Merged

cursedcoder merged 1 commit into
KnpLabs:masterfrom
Nyholm:httplug

Conversation

@Nyholm

@Nyholm Nyholm commented Jun 12, 2016 •

Copy link
Copy Markdown
Collaborator

This PR replaces #352. We do not want to be coupled to Guzzle, instead we want to use an abstraction layer so the end user can choose what HTTP message implementation to use.

This PR removes all our HTTP layer and replaces it with Httplug and custom plugins. I struggled for a while to make this PR backwards compatible but the code got too complicated and would have left us with an abstraction for an abstraction.

Question to the maintainers:
Do you like this change? Should I continue with this PR and complete the TODOs?

TODO

  • Add some more docs about HTTP plug in the readme.
  • Make sure existing docs are up to date
  • Make sure the tests passes

@Nyholm Nyholm mentioned this pull request Jun 12, 2016
Comment thread lib/Github/Client.php Outdated
{
if (null === $this->httpClient) {
$this->httpClient = new HttpClient($this->options);
if ($this->pluginsModified) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you need to reset this property here, otherwise a new client will be created for each call to the getter

@cursedcoder

cursedcoder commented Jun 24, 2016 •

Copy link
Copy Markdown
Contributor

@Nyholm looks good!

What do you guys say @docteurklein @gquemener ?

P.S. that's a good candidate for 2.0

@Nyholm

Nyholm commented Jun 25, 2016

Copy link
Copy Markdown
Collaborator Author

Thank you. I'll make the changes you suggested. Give me a couple of days.

@gquemener

Copy link
Copy Markdown
Contributor

I totally agree with the idea of using an http client abstraction!

@Nyholm

Nyholm commented Jun 26, 2016

Copy link
Copy Markdown
Collaborator Author

The tests are passing. I might need help making sure the docs are up to date. I will try to proof read the existing docs tomorrow.

More reviews are much welcome. Also, please try it out in your project to make sure I haven't missed anything.

@cursedcoder

Copy link
Copy Markdown
Contributor

@Nyholm will be able to check it tomorrow!

Comment thread lib/Github/Api/AbstractApi.php Outdated
}
$response = $this->client->getHttpClient()->get($path, $parameters, $requestHeaders);

if (count($parameters)>0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

count($parameters) > 0 or 0 !== count($parameters)

@cursedcoder

Copy link
Copy Markdown
Contributor

fantastic work you have done here @Nyholm
I will try it on our project in some days and also check the docs

@Nyholm

Nyholm commented Jun 29, 2016

Copy link
Copy Markdown
Collaborator Author

Thank you @cursedcoder. I've updated the code according to your comments. They all makes perfect sense and some were just typos of mine.

Please do.

Comment thread README.md Outdated
> `php-github-api` follows the PSR-0 convention names for its classes, which means you can easily integrate `php-github-api` classes loading in your own autoloader.
> `php-github-api` follows the PSR-4 convention names for its classes, which means you can easily integrate `php-github-api` classes loading in your own autoloader.

Why `php-http/guzzle6-adapter`? We are decoupled form any HTTP messaging client with help by [HTTPlug](http://httplug.io/). Read about clients in our [docs](doc/cusomize.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo in cusomize

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you.

@Nyholm

Nyholm commented Jul 10, 2016

Copy link
Copy Markdown
Collaborator Author

I've fixed the typo and rebased the PR.

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.

6 participants