Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A little web server in PHP
PHP
branch: master

This branch is 16 commits behind dhotson:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
classes
README.mkdn
demoapp.php
kelpie_init.php

README.mkdn

= Kelpie

A little web server in PHP.

== Installation

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

== Usage

An simple web application:

class HelloWorldApp
{
    public function call($env)
    {
        return array(
            200,
            array("Content-Type" => "text/plain"),
            array("hello world")
        );
    }
}

The interface is basically the same as Ruby's Rack:

* http://chneukirchen.org/blog/archive/2007/02/introducing-rack.html

To start the server:

require_once '/path/to/kelpie/lib/kelpie_init.php';
$server = new Kelpie_Server('0.0.0.0', 8000);
$server->start(new HelloWorldApp());

== Credits

This little project is heavily 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.

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.

I also blatantly stole Chris Corbyn's PHP autoloader from Swift Mailer:

Something went wrong with that request. Please try again.