Skip to content

Adds guzzle http client library#38

Merged
kyrylo merged 3 commits intoairbrake:masterfrom
danielpieper:guzzle
Jul 21, 2016
Merged

Adds guzzle http client library#38
kyrylo merged 3 commits intoairbrake:masterfrom
danielpieper:guzzle

Conversation

@danielpieper
Copy link
Copy Markdown

Sends notifications using guzzle post requests

Because of strict php.ini settings (allow_url_fopen=0) we cannot use file_get_contents to send out airbrake notifications. So i replaced it with the guzzle library.

@kyrylo
Copy link
Copy Markdown
Contributor

kyrylo commented Apr 29, 2016

Thanks for the PR! I assume this is a fix for #31. Looks like the build is failing, though.

@danielpieper
Copy link
Copy Markdown
Author

@kyrylo yes it's failing because the CircleCi uses an older version of PHP (5.4) but the guzzle library needs at least version 5.5.
Is it a constraint for you to be compatible with older versions of PHP or could you update the CircleCi PHP version?

@vmihailenco
Copy link
Copy Markdown
Contributor

Sorry for delay, but I think that we need to add support for several HTTP-clients and then provide users ability to switch between raw PHP client and guzzle. Then we can consider making guzzle a default backend.

Comment thread src/Notifier.php Outdated
'headers' => isset($http_response_header) ? $http_response_header : [],
'data' => $respData,
];
$handler = (isset($this->opt['httpClient'])?$this->opt['httpClient']:null);
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.

Can you please add spaces around ? and :?

@vmihailenco
Copy link
Copy Markdown
Contributor

Looks good. Can you please address my comments and squash commits so I can merge this? Thanks.

Comment thread src/Http/Factory.php Outdated

namespace Airbrake\Http;

use GuzzleHttp\Client;
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.

Just wonder if this works when guzzle is not installed...

@danielpieper
Copy link
Copy Markdown
Author

danielpieper commented Jul 5, 2016

Thanks for your review, i fixed some issues but still tests and documentation/ readme are missing. i will add them soon

@kyrylo
Copy link
Copy Markdown
Contributor

kyrylo commented Jul 18, 2016

Gentle ping @danielpieper. Would love to see this PR merged! :)

@danielpieper
Copy link
Copy Markdown
Author

@kyrylo I removed the (magic) client detection to stick to the live client's behavior. As the guzzle client library requires PHP >= 5.5 this test will be skipped on circle ci.

Daniel Pieper and others added 3 commits July 20, 2016 08:14
Sends notifications using guzzle post requests
Removes (magic) client detection
Adds factory test
Disables guzzle test for php 5.4
Comment thread README.md
- Curl needs the curl php extension installed. See phpinfo().
- The default client uses the php function "file_get_contents". Make sure
"allow_url_fopen" is set to "1" in your php.ini.
If not set the default client is used.
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.

This is pretty vague. Could we mention what exactly this 'default' client is?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this line describes the default client. Which information would you like to add?

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.

I was thinking about linking to the file, but seems like file_get_contents is well-known. Never mind :)

@kyrylo
Copy link
Copy Markdown
Contributor

kyrylo commented Jul 20, 2016

Thanks, @danielpieper! It looks fantastic. I just have a few questions/comments, but overall this looks good.

@kyrylo kyrylo merged commit 7d025e0 into airbrake:master Jul 21, 2016
@danielpieper danielpieper deleted the guzzle branch July 21, 2016 11:57
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.

3 participants