How to use unix domain sockets with the Zend Framework

Using the client

$client = new Client();
    'maxredirects' => 0,
    'timeout'      => 30
$response = $client->send();
echo $response->getContent();

Using the socket

$uri = new Zend\Uri\SocketHttp\SocketHttp("unix:///run/docker.sock:/v1.13/version");
$socket = new Client\Adapter\Socket();
    'maxredirects' => 0,
    'timeout' => 30,
$socket->connect($uri->getHost(), 0, false, true);
$socket->write('GET', $uri);
$str = $socket->read();
HTTP/1.1 200 OK
Content-Type: application/json
Job-Name: version
Date: Thu, 28 Aug 2014 22:33:17 GMT
Content-Length: 144



  1. Valuable data. Privileged myself I came across your site inadvertently, with this particular amazed the key reason why the following coincidence wouldn’t took place beforehand! My partner and i added them.

  2. Really This blog is awesome! I was searching over search engines and found your blog site. Well I like your high-quality blog site design plus your posting abilities. Keep doing it.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>