PHPackages                             danidoble/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. [API Development](/categories/api)
4. /
5. danidoble/klein

ActiveLibrary[API Development](/categories/api)

danidoble/klein
===============

A lightning fast router for PHP

v2.2.0(3y ago)0478MITPHPPHP ^8.1

Since Jan 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/danidoble/klein)[ Packagist](https://packagist.org/packages/danidoble/klein)[ Docs](https://github.com/danidoble/klein)[ RSS](/packages/danidoble-klein/feed)WikiDiscussions master Synced today

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

Klein
=====

[](#klein)

[![Build Status](https://camo.githubusercontent.com/ef931beb054e4231970a882e5b5cb4fbc26e81cb72faeaaad171ffc6f9b9afd0/68747470733a2f2f7472617669732d63692e6f72672f64616e69646f626c652f6b6c65696e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/danidoble/klein)

**Notes:**

- This is a fork of [klein/klein.php](https://github.com/klein/klein.php)
- This project was upgraded to PHP ^8.1

**klein** is a fast &amp; flexible router for PHP 8.1+

- 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 8.1.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 danidoble/klein`
3. Add the following to your application's main PHP file: `require 'vendor/autoload.php';`

Example
-------

[](#example)

*Hello World* - Obligatory hello world example

```
