Navigation Menu

Skip to content

phuedx/seraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seraph

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

Motivation

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:

<?php

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://127.0.0.1:9997', 'tcp://127.0.0.1:9996')
    ->registerApplication($app)
    ->run();

See Also

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

License

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

About

[ABANDONED] A framework for writing handlers for Mongrel2 in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages