PHPackages                             reactphp-x/route - 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. reactphp-x/route

ActiveLibrary

reactphp-x/route
================

v1.0.0(1y ago)1621MITPHP

Since Sep 19Pushed 9mo agoCompare

[ Source](https://github.com/reactphp-x/route)[ Packagist](https://packagist.org/packages/reactphp-x/route)[ RSS](/packages/reactphp-x-route/feed)WikiDiscussions master Synced 1mo ago

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

reactphp-x-route
================

[](#reactphp-x-route)

"Framework X has provided a wealth of inspiration." - [Framework X](https://framework-x.org/)

Like Laravel Route support

- middleware
- group

install
-------

[](#install)

```
composer require reactphp-x/route -vvv

```

usage
-----

[](#usage)

### in http server

[](#in-http-server)

```
use ReactphpX\Route\Route;
use FrameworkX\AccessLogHandler;
use FrameworkX\ErrorHandler;

$container = new DI\Container();

$route = new Route($container);

$route->get('/', function () {
    return new React\Http\Message\Response(
        200,
        ['Content-Type' => 'text/plain'],
        "Hello, World!\n"
    );
});
$route->group('/api', function ($route) {
    $route->get('/hello', function () {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "Hello, API!\n"
        );
    });
    $route->get('/world', function () {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "World, API!\n"
        );
    });
});

$class = new class {
    public function index()
    {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "Hello, Class!\n"
        );
    }
};

$route->get('/at', get_class($class).'@index');

$http = new React\Http\HttpServer(
    new AccessLogHandler(),
    new ErrorHandler(),
    $route
);

$socket = new React\Socket\SocketServer(getenv('X_LISTEN'));
$http->listen($socket);

echo "Server running at http://".getenv('X_LISTEN'). PHP_EOL;
```

### in FrameworkX

[](#in-frameworkx)

```
use ReactphpX\Route\FrameworkXRoute;

$app = new FrameworkX\App();

$route = new FrameworkXRoute($app);

$route->get('/', function () {
    return new React\Http\Message\Response(
        200,
        ['Content-Type' => 'text/plain'],
        "Hello, World!\n"
    );
});
$route->group('/api', function ($route) {
    $route->get('/hello', function () {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "Hello, API!\n"
        );
    });
    $route->get('/world', function () {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "World, API!\n"
        );
    });
});

// 不支持 @
// $class = new class {
//     public function index()
//     {
//         return new React\Http\Message\Response(
//             200,
//             ['Content-Type' => 'text/plain'],
//             "Hello, Class!\n"
//         );
//     }
// };

// $route->get('/at', get_class($class).'@index');

$app->run();

echo "Server running at http://".getenv('X_LISTEN'). PHP_EOL;
```

### in FrameworkX and support @

[](#in-frameworkx-and-support-)

```
use ReactphpX\Route\Route;

$container = new DI\Container();
$route = new Route($container);
$app = new FrameworkX\App(
    $route
);

//$app->any('{path:.*}', $route);

$route->get('/', function () {
    return new React\Http\Message\Response(
        200,
        ['Content-Type' => 'text/plain'],
        "Hello, World!\n"
    );
});
$route->group('/api', function ($route) {
    $route->get('/hello', function () {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "Hello, API!\n"
        );
    });
    $route->get('/world', function () {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "World, API!\n"
        );
    });
});

$class = new class {
    public function index()
    {
        return new React\Http\Message\Response(
            200,
            ['Content-Type' => 'text/plain'],
            "Hello, Class!\n"
        );
    }
};

$route->get('/at', get_class($class).'@index');

$app->run();

echo "Server running at http://".getenv('X_LISTEN'). PHP_EOL;
```

Tests
-----

[](#tests)

```
./vendor/bin/phpunit tests/RoutesTest.php

```

License
-------

[](#license)

MIT

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance48

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

606d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/76907477?v=4)[wpjscc](/maintainers/wpjscc)[@wpjscc](https://github.com/wpjscc)

---

Top Contributors

[![wpjscc](https://avatars.githubusercontent.com/u/76907477?v=4)](https://github.com/wpjscc "wpjscc (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/reactphp-x-route/health.svg)

```
[![Health](https://phpackages.com/badges/reactphp-x-route/health.svg)](https://phpackages.com/packages/reactphp-x-route)
```

PHPackages © 2026

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