PHPackages                             drmyersii/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. drmyersii/klein

ActiveLibrary

drmyersii/klein
===============

A lightning fast router for PHP

v2.1.1(10y ago)026MITPHPPHP &gt;=5.3.0

Since Feb 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/drmyersii/klein.php)[ Packagist](https://packagist.org/packages/drmyersii/klein)[ Docs](https://github.com/chriso/klein.php)[ RSS](/packages/drmyersii-klein/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (10)Used By (0)

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

[](#kleinphp)

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

**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

```
