PHPackages                             meowphp/routing - 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. meowphp/routing

ActiveLibrary[Framework](/categories/framework)

meowphp/routing
===============

Extendable router

v0.1.0(4y ago)111[1 PRs](https://github.com/meowphp/routing/pulls)1MITPHPPHP &gt;=8.0CI passing

Since Nov 11Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/meowphp/routing)[ Packagist](https://packagist.org/packages/meowphp/routing)[ Docs](https://github.com/meowphp/routing)[ RSS](/packages/meowphp-routing/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (1)

Routing
=======

[](#routing)

**namespace:** `meow\routing`

Extendable Router that uses Attributes to define routes to methods

[![ko-fi](https://camo.githubusercontent.com/201ef269611db7eb6b5d08e9f756ab8980df3014b64492770bdf13a6ed924641/68747470733a2f2f6b6f2d66692e636f6d2f696d672f676974687562627574746f6e5f736d2e737667)](https://ko-fi.com/D1D5DMOTA)

Installing
----------

[](#installing)

You can install this library with composer by running following command

```
composer require meowphp/routing
```

Usage
-----

[](#usage)

### Registering controllers

[](#registering-controllers)

This router need to have statically registered controllers in array. To do that add somewhere in your app array with controller classes strings:

```
/**
 * Register your application's controller here
*/
$controllers => [
    \May\AttributesTest\MainController::class,
    \May\AttributesTest\Controllers\ExampleController::class
],
```

### Defining routes

[](#defining-routes)

To define routes to the action use `Route` attribute for your methods:

```
# Route without attributes
#[Route('/hello/{id}/{surname}')]
public function sayHello() : string

# Route with attributes
#[Route("/good-bye")]
public function sayGoodBye() : string

# Default route
#[Route('/')]
public function index() : string
```

### Getting new Router instance

[](#getting-new-router-instance)

To get new router use script as follows.

```
$router = \Meow\Routing\Router::getRouter($controllers);
```

### Resolving routes

[](#resolving-routes)

```
$calledRoute = $this->router->matchFromUri('/your/route');
```

### Getting controller and action

[](#getting-controller-and-action)

Code above will return instance of route so to get controller and action use functions below

```
$calledRoute->getController();
$calledRoute->getMethod();
```

### Getting parameters

[](#getting-parameters)

```
if ($calledRoute->hasParameters()) {
    $request = $calledRoute->getParameters();
}
```

### Prefixes

[](#prefixes)

Prefixes can be applied on router class. After applying them router starts with prefix `/{prefix}/{action}`. So instead of defining routes as `/users/action` and `/users/action-two` You can use Prefix and `/users` and then define route for actions as `/action` and `/action-two`. Example bellow:

```
#[Prefix('/api')]
class ExampleController extends AppController
```

**License: MIT**

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance53

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

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

1648d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7c2bca298b9947b96e7d8ecc3e58d2a63caf97adb52d28c07dc8b9468cdabb6?d=identicon)[maymeow](/maintainers/maymeow)

---

Top Contributors

[![MayMeow](https://avatars.githubusercontent.com/u/3164256?v=4)](https://github.com/MayMeow "MayMeow (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/meowphp-routing/health.svg)

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

###  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)
