A little web server in php


Kelpie is a web server for PHP that takes inspiration from the best bits of the Ruby web server ecosystem:


Here's what a simple Kelpie application looks like:

class HelloWorld
  public function call($env)
    return array(
      array("Content-Type" => "text/plain"),
      array("Hello World")

The call method accepts an array of CGI like environment variables and returns an array of status code, headers, and body.

To run a Kelpie app, you need to start a server:

require_once 'lib/kelpie.php';
$server = new Kelpie_Server('localhost', 8000);
$server->start(new HelloWorld());

Then in your web browser visit http://localhost:8000


Get the Kelpie source code from github:

git clone

Kelpie requires the httpparser extension. It's a PHP extension for the Mongrel http parser.

sudo aptitude install php-pear php5-dev sudo pear channel-discover sudo pear install kelpie/httpparser


Kelpie is still under active development.

Use it at your own peril. ;-)

Please get in touch if you would like to contribute.


Thanks go to the people behind Rack, Thin and Mongrel. Also, a big thank you to Alexey Zakhlestin for his code review and contributions to get the httpparser php extension into decent shape.


Kelpie is MIT. The httpparser extension is GPL.