J7mbo/twitter-api-php — pull request #94 by manuakasam (2014-12-22 16:13:41+00:00)
Title: Feature/additional curl options on request

This pull request contains a very simple addition of allowing the use of additional curl options to be set for requests against the twitter api.

*Attention*: The pull request also contains Code-Style Improvements, therefore it looks far more than it is. The only code-change happening is within `performReqeust()` (new line 189 and 206).

### Why?

Environments are different all around the world and thus the need for specific curl options vary a lot. While the defaults provided are quite sane, they do not cover two of the most commonly known use-cases:

- `CURLOPT_SSL_VERIFYPEER`
- `CURLOPT_PROXY` as well as `CURLOPT_PROXYPORT`

As there is no way to set these options properly for the single request using the current class and extending the class is a bit annoying (hello privates), we need this way to set the options.

### How to use it?

The `Union`- operator of PHP merges 2 arrays based on their key. See http://php.net/manual/en/language.operators.array.php#86379

This allows us to set additional options in the likes of

```php
$curlOptions = array(
CURLOPT_SSL_VERIFYPEER => false
);

if (!strstr($_SERVER['HTTP_HOST'], 'evocube')) {
$curlOptions[CURLOPT_PROXY] = 'http://10.20.31.2:8080';
$curlOptions[CURLOPT_PROXYPORT] = 8080;
}

$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(true, $curlOptions);
```

### BC Breaks?

None. A sane default is provided and only has impact if the new - optional - parameter is actively used.

No differences in any PHP Version. One failure on an older HHVM release which can likely be neglected. Whoever uses HHVM updates a lot... See http://3v4l.org/KZBD9