Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (63 sloc) 2.17 KB

Simple library for writing Mongrel2 clients in PHP 5.3+ using zeromq 2.2


echo '[Installing ØMQ 2.2]' && ./install/
echo '[Installing ØMQ PHP Module]' && ./install/
echo '[Installing pecl_http Module]' && ./install/
echo '[Installing Composer]' && curl -s | php && php composer.phar install
echo '[Installing Mongrel2 Web Server]' && ./install/

Simple Client Example

// Create a new Mongrel client
$mongrelClient = new \Mongrel\Client(
    new \ZMQContext,
    new \Mongrel\Dsn( 'tcp://' ),
    new \Mongrel\Dsn( 'tcp://' )

// Create a new Mongrel HTTP client
$client = new \Mongrel\Http\Client( $mongrelClient );

// Listen for requests
while( true )
    /* @var $request \Mongrel\Http\Request */
    $request = $client->recv();

    // Build a response
    $response = new \Mongrel\Http\Response( '<h1>Hello World!</h1>', array( 'Content-Type' => 'text/html' ) );

    // Send response back to the browser that requested it
    $client->reply( $response, $request );

    // Clean up
    unset( $request, $response );

Mustache View Renderer Example

sh examples/
sh examples/mustache/devices/ # (in another window)

Open localhost:8001 in your web browser



Travis CI




Released under the MIT(Poetic) Software license

This work 'as-is' we provide.
No warranty express or implied.
Therefore, no claim on us will abide.
Liability for damages denied.

Permission is granted hereby,
to copy, share, and modify.
Use as is fit,
free or for profit.
These rights, on this notice, rely.