Klein

A lightning fast router for PHP 5.3+

Home

klein.php is a lightning fast router for PHP 5.3+

  • Flexible regular expression routing (inspired by Sinatra)
  • A set of boilerplate methods for rapidly building web apps
  • Almost no overhead => 2500+ requests/second

Example

Hello World - Obligatory hello world example

<?php
require_once __DIR__ . '/vendor/autoload.php';

$klein = new \Klein\Klein();

$klein->respond('GET', '/hello-world', function () {
    return 'Hello World!';
});

$klein->dispatch();
Fork me on GitHub