# klein/klein.php

A fast & flexible router

Repository: https://github.com/klein/klein.php
Canonical: https://ross.abutalabs.com/products/kleinphp
Language: PHP
License: MIT
License Family: permissive
Topics: php, router, routing, http, request-uri
Last push: 2024-01-30T11:16:48+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 5630, "days_push": 946, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2657, forks 286 (observed 2026-08-28T04:07:07.322079+00:00)

## What it is
Klein.php is a fast and flexible routing library for PHP 5.3+, inspired by Sinatra. It provides regex-based routing with named parameters, RESTful method handling, and boilerplate methods for building web apps with minimal overhead.

## Use cases
- route http requests in a php application
- build a restful api in php
- define routes with named parameters
- handle get post put delete requests
- serve files and  xml csv responses
- build a small web app without a full framework

## When to choose
- you need a lightweight standalone router for a php project
- you want sinatra-style routing with named parameters
- you are building a small api or microsite without a heavy framework

## When to avoid
- you need a full-featured framework with orm, templating, and auth built in
- your project targets modern php versions and you want actively developed routing
- you need async or long-polling request handling

## Facets
- artifact type: library
- maturity: maintenance
- function: routing, web-framework, http-server, middleware
- domain: web-development, backend, apis
- platform: php
- tags: sinatra-inspired, rest-routing, micro-framework, url-rewriting

## Member repositories
- klein/klein.php (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:07.322079+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:18:27.297319+00:00, confidence not recorded.
  - readme: https://github.com/klein/klein.php (fetched 2026-08-28T04:07:07.322079+00:00, sha 1ce3f97bc532)
- Data as of 2026-08-30T08:39:29.467469+00:00.
