ManaPHP\Http\Client::__construct PHP Method

__construct() public method

Client constructor.
public __construct ( array $options = [], array $headers = [] )
$options array - `timeout`: How long should we wait for a response? (integer, seconds, default: 10) - `max_redirects`: How many times should we redirect 3xx before error? (integer, default: 10) (string, default: '') - `proxy`: Proxy details to use for proxy by-passing and authentication (string, default: '') - `ssl_certificates`: Should we verify SSL certificates? Allows passing in a custom certificate file as a string. (Using true uses the system-wide root certificate store instead, but this may have different behaviour across transports.) (string, default: 'xxx/ca.pem') - `verify_host`: Should we verify the common name in the SSL certificate? (bool: default, true)
$headers array - `User-Agent`: User Agent to send to the server (string, default: php-requests/$version)
    public function __construct($options = [], $headers = [])
    {
        if (!function_exists('curl_init')) {
            throw new ClientException('curl extension is not loaded: http://php.net/curl');
        }
        $defaultOptions = ['timeout' => 10, 'max_redirects' => 10, 'proxy' => '', 'ssl_certificates' => '@manaphp/Http/Client/ca.pem', 'verify_host' => true];
        $this->_options = array_merge($defaultOptions, $options);
        $defaultHeaders = ['User-Agent' => 'ManaPHP/httpClient'];
        $this->_headers = array_merge($defaultHeaders, $headers);
    }