facebook/facebook-php-sdk-v4 — pull request #84 by SammyK (2014-05-20 00:31:12+00:00)
Title: Added feature to inject custom HTTP clients

Take a deep breath...! The very much needed injectable HTTP client handler PR is here! :) This would close #4.

## Usage

You can inject your own HTTP client in two steps:

1. Code to the `Facebook\FacebookHttpable` interface.
2. Inject your implementation like so:

```php
FacebookRequest::setHttpClientHandler(new MyCustomHttpClient());
```

I've posted examples of [Guzzle and stream wrapper implementations](https://github.com/SammyK/example-facebook-php-sdk-v4-http-clients).

## Considerations

- I really tried to decouple the code in the `FacebookRequest` object in this refactor. The `execute()` method was especially getting out of hand. It's not perfect yet, but it's much better than before.

- I killed the IPv6 workaround since it was broken anyways - even with the latest fix 0a34085dee67f6b55fb6dd1987d42265cc9b57ec. And it really shouldn't be the responsibility of the SDK to fix people's misconfigured servers. :)

- This merge is going to cause some serious conflicts with #75. But I hope you can see why we don't need #75 with this PR since the [stream implementation](https://github.com/SammyK/example-facebook-php-sdk-v4-http-clients/blob/master/src/FacebookStreamHttpClient.php) can be easily injected by the developer.

- If you'd like to include the Guzzle and stream wrapper implementations in the SDK, that would make it easy for a developer to just inject a new implementation with just two lines of code without even having to write anything new on their own:

```php
use Facebook\FacebookStreamHttpClient;
FacebookRequest::setHttpClientHandler(new FacebookStreamHttpClient());
```

- There is a new dev dependency in the `composer.json` file. It pulls in [mockery](https://github.com/padraic/mockery) so that we can mock dependancies. The test suite doesn't test in isolation enough and mockery will make it easier to do that going forward. So make sure to run `composer update` when you pull this one in to test.

## The end

Let me know if you have any questions on anything!