PHPackages                             tkaratug/titan-router - 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. [Framework](/categories/framework)
4. /
5. tkaratug/titan-router

ActiveLibrary[Framework](/categories/framework)

tkaratug/titan-router
=====================

A simple and lightweight PHP router

v1.0.0(8y ago)2211MITPHPPHP &gt;=5.4.0

Since Oct 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/tkaratug/titan-router)[ Packagist](https://packagist.org/packages/tkaratug/titan-router)[ Docs](https://github.com/tkaratug/titan-router)[ RSS](/packages/tkaratug-titan-router/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Titan Router
============

[](#titan-router)

A simple and lightweight PHP router. Built by Turan Karatuğ ()

Features
--------

[](#features)

- Supports `GET`, `POST`, `PUT`, `DELETE`, `OPTIONS`, `PATCH` and `HEAD` request methods
- Static Route Patterns
- Dynamic Route Patterns
- Easy-to-use patterns
- Allowance of `Class@Method` calls
- Before Route Middlewares
- Namespaces Supports
- Route Groups Supports
- Subdomain Supports
- Subfolder Supports
- Custom 404 Handling

Installation
------------

[](#installation)

Installation is possible using Composer

```
composer require tkaratug/titan-router

```

Usage
-----

[](#usage)

```
require __DIR__ . '/vendor/autoload.php';

use Titan\Router\Router as Route;

Route::get('/', function(){
    echo 'Hello world!';
});

Route::execute();
```

Shorthands for single request methods are provided:

```
Route::get('pattern', function() { /* ... */ });
Route::post('pattern', function() { /* ... */ });
Route::put('pattern', function() { /* ... */ });
Route::delete('pattern', function() { /* ... */ });
Route::options('pattern', function() { /* ... */ });
Route::patch('pattern', function() { /* ... */ });
```

Note: Routes must be hooked before `Route::execute()` is being called.

`Class@Method` calls
--------------------

[](#classmethod-calls)

We can route to the class action like so:

```
Route::get('/profile', 'User@viewProfile'); // Without namespace
Route::get('/product/{num}', 'App\Controllers\Product@detail'); // With namespace
```

Before Route Middlewares
------------------------

[](#before-route-middlewares)

```
Route::middleware(['auth'])->group(function(){
    Route::get('/dashboard', function(){ /* ... */} );
});
```

Namespaces Supports
-------------------

[](#namespaces-supports)

```
Route::namespace('backend')->group(function(){
    // Controllers Within The "Controllers\Backend" Namespace
});
```

Subfolder Supports
------------------

[](#subfolder-supports)

```
Route::prefix('admin')->group(function(){
    Route::get('users', function(){
        // Matches The "/admin/users" URL
    });
});
```

Subdomain Supports
------------------

[](#subdomain-supports)

```
Route::domain('api.example.com')->group(function(){
    Route::get('user/{num}', function($id){
        //
    });
});
```

Multiple Groups
---------------

[](#multiple-groups)

```
Route::namespace('backend')->prefix('admin')->middleware(['auth'])->group(function(){
    Route::get('/', 'Dashboard@index');
    // Controller = Controllers\Backend\Dashboard
    // URL = /admin
    // Middleware = Auth
});
```

### Custom 404

[](#custom-404)

Override the default 404 handler using `Route::set404(function);`

```
Route::set404(function() {
    header('HTTP/1.1 404 Not Found');
    // ... do something special here
});
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3170d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4394344?v=4)[Turan Karatuğ](/maintainers/tkaratug)[@tkaratug](https://github.com/tkaratug)

---

Top Contributors

[![tkaratug](https://avatars.githubusercontent.com/u/4394344?v=4)](https://github.com/tkaratug "tkaratug (9 commits)")

---

Tags

routerrouting

### Embed Badge

![Health badge](/badges/tkaratug-titan-router/health.svg)

```
[![Health](https://phpackages.com/badges/tkaratug-titan-router/health.svg)](https://phpackages.com/packages/tkaratug-titan-router)
```

###  Alternatives

[klein/klein

A lightning fast router for PHP

2.7k1.1M31](/packages/klein-klein)[pecee/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

675224.9k18](/packages/pecee-simple-router)[vlucas/bulletphp

A heierarchical resource-oriented micro-framework built on nested closures instead of route-based callbacks

41650.0k1](/packages/vlucas-bulletphp)[izniburak/router

simple router class for php

23323.2k7](/packages/izniburak-router)[vectorface/snappy-router

A quick and snappy routing framework.

4615.2k](/packages/vectorface-snappy-router)[thewunder/croute

Convention based routing for PHP

1319.4k](/packages/thewunder-croute)

PHPackages © 2026

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