Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A framework for writing handlers for Mongrel2 in PHP.
branch: develop

Manage dependencies with Composer

* Remove Git submodules
* Remove the __seraph_autoload autoloader in favour of the Composer
latest commit adacef489b
@phuedx authored



Seraph is a framework for writing handlers for Mongrel2 in PHP.


You've heard of Mongrel2, right? One of the many awesome features of Mongrel2 is that it supports handlers. I think of handlers as long-running applications that publish responses to requests that are pulled from a Mongrel2 server using a couple of ØMQ sockets.

I wrote Seraph because I wanted to highlight that, with the help of Mikko Koppanen's "php-zmq" PHP extension, PHP is no longer bound by the lifecycle of an Apache web server.

Hello, World

Here's the smallest "Hello, World!" application that I can write cleanly:


require_once '/path/to/seraph/autoload.php';

// App
class HelloWorldApp implements Seraph_Application_Interface
    public function onRequest(Seraph_Request $request, Seraph_Response $response) {
        $response->setBody('Hello, World!');

$app = new HelloWorldApp();

// Handler
$signals = new Seraph_Signal_Collection();
$handler = new Seraph_Handler('seraph_handler_test', $signals);
$handler->registerServer('Mongrel2', 'tcp://', 'tcp://')

See Also

  1. The Mongrel2 Web Server Project
  2. ØMQ Community - zeromq
  3. mkoppanen/php-zmq - GitHub


Seraph is licensed under the MIT license and is copyright (c) 2011 Sam Smith. See the LICENSE file for full copyright and license information.

Something went wrong with that request. Please try again.