PHPackages                             lawondyss/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. lawondyss/router

ActiveLibrary[Framework](/categories/framework)

lawondyss/router
================

Small PHP library for creating app routes. Using only at for your own risk, this is for my educational purposes.

00PHP

Since Feb 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Lawondyss/Router)[ Packagist](https://packagist.org/packages/lawondyss/router)[ RSS](/packages/lawondyss-router/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Router
======

[](#router)

Simply PHP library to create REST API.

Requirements
------------

[](#requirements)

Strictly requires PHP 7.4

Install
-------

[](#install)

Via Composer: `composer require lawondyss/router`

Usage
-----

[](#usage)

Simply instantiate.

```
use Lawondyss\Sandy\Router\Router;

require_once __DIR__ . '/vendor/autoload.php';

$router = new Router;
```

No static. Why not?

### Defining routes

[](#defining-routes)

Add routes for HTTP method(s) and URL path (as mask). Callback can processing request and editing response.

```
// predefined HTTP method
$router->get('/', function (Request $request, Response $response) {
  $response->body = 'Hello world';
});

// predefined HTTP method
$router->post('/foo/bar', function(Request $request, Response $response) {
  $response->code = Response::S201_CREATED;
});

// own definition of valid HTTP methods (PUT and PATCH)
$router->add(Router::PUT | Router::PATCH, '/foo/bar', function (Request $request, Response $response) {
  $response->code = Response::S204_NO_CONTENT;
  $response->addHeader('X-Lipsum-Message', 'Lorem ipsum dolor sit amet');
});
```

### Parameters in mask

[](#parameters-in-mask)

For catching segments of URL use `{` and `}`.

Optional segments of URL is in between `[` and `]`.

Definition of regex validation for catching segment is after `:`.

All catching segments is in `Request::$params`.

```
$router->get('/foo/{bar:\d+}[/{baz:[a-z]+}]', function(Request $request, Response $response) {
  $response->contentType = 'application/json';
  $response->body = json_encode($request->params);
});
```

Motivation
----------

[](#motivation)

Mainly for my educational purposes.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f642f8a219fdaad6b73c302bfc3a623148b8eefd58ea4078cdfae1f24c47fc5?d=identicon)[Lawondyss](/maintainers/Lawondyss)

---

Top Contributors

[![Lawondyss](https://avatars.githubusercontent.com/u/272130?v=4)](https://github.com/Lawondyss "Lawondyss (2 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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