Skip to content

dhotson/kelpie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

Kelpie can be installed with composer.

Add this to your composr.json:

"dhotson/kelpie": "dev-master"

Usage

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());

Credits

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.

About

A little web server in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages