/guzzle-socket-handler

Unix socket handler for guzzle 6. (deprecated since cURL 7.40.0)

Primary LanguagePHPMIT LicenseMIT

Guzzle Socket Handler Build Status Code Climate

Warning
This package is deprecated since cURL 7.40.0.
Use curl_setopt with CURLOPT_UNIX_SOCKET_PATH option instead of this package (available in cURL 7.40.0 (PHP 7.0.7))

Unix socket handler for guzzle 6.

Installation

composer require psrebniak/guzzle-socket-handler

Usage:

\GuzzleHttp\Client([
    'handler' => new \psrebniak\GuzzleSocketHandler\SocketHandlerFactory(
        $path
        [, $domain = AF_UNIX 
        [, $type = SOCK_STREAM 
        [, $protocol = SOL_SOCKET
        ]]]
    )
]); 

Request options (from \psrebniak\GuzzleSocketHandler\SocketOptions)

  • SOCKET_TIMEOUT - alias of RequestOptions::CONNECT_TIMEOUT
  • SOCKET_DEBUG - alias of RequestOptions::DEBUG

Done:

  • sending JSON ($options[RequestOptions::JSON] key)
  • sending form params ($options[RequestOptions::FORM_PARAMS] key)
  • sending multipart ($options[RequestOptions::multipart] key)
  • tracking redirects ($options[RequestOptions::ALLOW_REDIRECTS] key)
  • timeout ($options[RequestOptions::CONNECT_TIMEOUT] key)
  • Http Authentication ($options[RequestOptions::AUTH] key)