PHPackages                             cineman/klein - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. cineman/klein

ActiveLibrary[HTTP &amp; Networking](/categories/http)

cineman/klein
=============

A lightning fast router for PHP

v2.1.1(9y ago)051MITPHPPHP &gt;=5.3.0

Since Feb 22Pushed 9y ago2 watchersCompare

[ Source](https://github.com/cineman/klein.php)[ Packagist](https://packagist.org/packages/cineman/klein)[ Docs](https://github.com/cineman/klein.php)[ RSS](/packages/cineman-klein/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (3)Versions (9)Used By (0)

Klein.php
=========

[](#kleinphp)

[![Build Status](https://camo.githubusercontent.com/6824cc48edbda773dce46bab6af6adc26a919702ae42f82b7c722571700ccd01/68747470733a2f2f7472617669732d63692e6f72672f63696e656d616e2f6b6c65696e2e7068702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/chriso/klein.php)

---

**Note:** The main "klein.php" repository seems to be inactive, in this fork we try to keep the projects maintenanced.

---

**klein.php** is a fast &amp; flexible router for PHP 5.3+

- Flexible regular expression routing (inspired by [Sinatra](http://www.sinatrarb.com/))
- A set of [boilerplate methods](#api) for rapidly building web apps
- Almost no overhead =&gt; [2500+ requests/second](https://gist.github.com/878833)

Getting started
---------------

[](#getting-started)

1. PHP 5.3.x is required
2. Install Klein using [Composer](#composer-installation) (recommended) or manually
3. Setup [URL rewriting](https://gist.github.com/874000) so that all requests are handled by **index.php**
4. (Optional) Throw in some [APC](http://pecl.php.net/package/APC) for good measure

Composer Installation
---------------------

[](#composer-installation)

1. Get [Composer](http://getcomposer.org/)
2. Require Klein with `php composer.phar require klein/klein`
3. Add the following to your application's main PHP file: `require 'vendor/autoload.php';`

Example
-------

[](#example)

*Hello World* - Obligatory hello world example

```
