PHPackages                             lukevear/tbone - 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. lukevear/tbone

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

lukevear/tbone
==============

An extremely fast micro PHP router

2.0.3(10y ago)027MITPHPPHP &gt;=5.4.0

Since Dec 17Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (8)Used By (0)

TBone
-----

[](#tbone)

[![Latest Stable Version](https://camo.githubusercontent.com/9576c5915e2b09b50caf7bc3bc4ad8aabc342b9c16af48e212c9d545e96915bb/68747470733a2f2f706f7365722e707567782e6f72672f6c756b65766561722f74626f6e652f762f737461626c65)](https://packagist.org/packages/lukevear/tbone)[![Build Status](https://camo.githubusercontent.com/b4e8e4b2d3c8d34e28afa0ee8ed3b95aa84b381f90ae1cb56fe5991106c446e7/68747470733a2f2f7472617669732d63692e6f72672f6c756b65766561722f74626f6e652e737667)](https://travis-ci.org/lukevear/tbone)[![Coverage Status](https://camo.githubusercontent.com/4a53b811371143aa54aebecc6d259325820d063746d3a5eb122618cbe2d4e36e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6c756b65766561722f74626f6e652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/lukevear/tbone?branch=master)[![License](https://camo.githubusercontent.com/ced48e0a19b26f2176a1996dbbf9556d762fa6cfce8f457c07f036636bb1d41e/68747470733a2f2f706f7365722e707567782e6f72672f6c756b65766561722f74626f6e652f6c6963656e7365)](https://packagist.org/packages/lukevear/tbone)

A very simple, very fast PHP router.
------------------------------------

[](#a-very-simple-very-fast-php-router)

- Exceptionally easy to use
- Supports OPTIONS, HEAD, GET, POST, PUT, PATCH and DELETE requests
- Simple event system for error handling

> Note: TBone does not support route parameters (such as /customers/{id})

### When to use TBone

[](#when-to-use-tbone)

TBone is designed to be used in in very simple, relatively static PHP applications where your application logic can sit within a set of closures. If you try to use TBone for anything beyond simple sites, you're going to have a bad time. If you're after something more impressive I would suggest [nikic/FastRoute](https://github.com/nikic/FastRoute).

### Installation

[](#installation)

```
composer require lukevear/tbone

```

### Activating the router

[](#activating-the-router)

You may use TBone wherever you feel is appropiate in your project, however the most common usage would be in an index.php file in your document directory. If running from an index.php file, you should have a .htaccess file similar to the one below.

```

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

```

### Basic Example

[](#basic-example)

```
use TBone\TBone;

$router = new TBone;

// Add a GET route
$router->get('/', function() {
    echo 'Welcome to my homepage';
});

// Add a POST route
$router->post('/contact-us', function() {
    echo 'Thanks for your submission';
});

// Run the router
$router->dispatch();
```

### Event System

[](#event-system)

TBone's event system exists to provide a mechanism for you to handle routing related events. TBone supports `ROUTE_DISPATCH_REQUESTED` (fired when dispatch() is called), `ROUTE_NOT_FOUND` (fired when a route cannot be matched) and `ROUTE_DISPATCHED` (fired when a route is matched and the callback has been run).

When an event is fired the specified callback will be run.

```
use TBone\TBone;
use TBone\TBoneEvent;

$router = new TBone;

// Add a GET route
$router->get('/', function() {
    echo 'Welcome to my homepage';
});

// Register our 404 page
$router->addHandler(TBoneEvent::ROUTE_NOT_FOUND, function() {
    http_response_code(404);
    echo 'Sorry, that page doesn\'t exist!';
});

// Run the router
$router->dispatch();
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

7

Last Release

3815d ago

Major Versions

1.0.2 → 2.0.02016-01-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11508219?v=4)[Luke Vear](/maintainers/lukevear)[@lukevear](https://github.com/lukevear)

---

Top Contributors

[![lukevear](https://avatars.githubusercontent.com/u/11508219?v=4)](https://github.com/lukevear "lukevear (35 commits)")

---

Tags

routerroutingroute

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lukevear-tbone/health.svg)

```
[![Health](https://phpackages.com/badges/lukevear-tbone/health.svg)](https://phpackages.com/packages/lukevear-tbone)
```

###  Alternatives

[symfony/routing

Maps an HTTP request to a set of configuration variables

7.7k835.3M2.4k](/packages/symfony-routing)[nikic/fast-route

Fast request router for PHP

5.4k97.5M745](/packages/nikic-fast-route)[aura/router

Powerful, flexible web routing for PSR-7 requests.

5001.5M69](/packages/aura-router)[pmjones/auto-route

Automatically routes HTTP request to action classes.

19960.8k6](/packages/pmjones-auto-route)[miladrahimi/phprouter

A powerful, lightweight, and very fast HTTP URL router for PHP projects.

20633.5k2](/packages/miladrahimi-phprouter)[contributte/api-router

RESTful Router for your Apis in Nette Framework - created either directly or via attributes

20809.0k3](/packages/contributte-api-router)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
