A little web server in PHP.
You'll need the httpparser extension, it's a PHP extension for the C http parser from the mongrel web server:
* http://github.com/dhotson/httpparser-php
Kelpie can be installed with composer.
Add this to your composr.json:
"dhotson/kelpie": "dev-master"
A simple web application:
class HelloWorldApp
{
public function __invoke($env)
{
return array(
200,
array("Content-Type" => "text/plain"),
array("Hello World")
);
}
}
The interface is basically the same as Ruby's Rack:
To start the server:
require_once 'vendor/autoload.php';
$server = new \Kelpie\Server('0.0.0.0', 8000);
$server->start(new HelloWorldApp());
This little project is inspired by the Thin web server and the Rack web server interface.
A lot of the classes are a direct port of Ruby classes in Thin and Rack. I can't claim much credit in writing them.
Thanks go to the guys who created Thin and Rack:
The http parser is from Mongrel http://mongrel.rubyforge.org by Zed Shaw. Mongrel Web Server (Mongrel) is copyrighted free software by Zed A. Shaw You can redistribute it and/or modify it under either the terms of the GPL.