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

AbandonedArchivedLibrary[Framework](/categories/framework)

extalion/routing
================

eXtalion routing component

0.1.0(8y ago)1131MITPHPPHP ^7.1

Since Oct 21Pushed 8y ago2 watchersCompare

[ Source](https://github.com/eXtalionTeam/routing)[ Packagist](https://packagist.org/packages/extalion/routing)[ RSS](/packages/extalion-routing/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (5)Versions (3)Used By (1)

Routing
=======

[](#routing)

Routing component to resolve Uri path

Install
-------

[](#install)

```
composer require extalion/routing
```

Route
-----

[](#route)

It's a class which represent the request method and Uri path. Also it store a knowledge what controller class create to handle the request.

```
use eXtalion\Component\Routing\Route;

$route = new Route\{Method}(
    $uriPath,
    $fullnameControllerClass
);
```

where:

- **{Method}** is a class name which represent request method. Available classnames/request methods:
- `Get`,
- `Post`,
- `Put`,
- `Update`,
- `Delete`,
- **$uriPath** is a valid Uri path which can contain parameters (see example),
- **$fullnameControllerClass** self explanatory name :-)

### Example:

[](#example)

```
new Route\Get('/', HomeController::class);
new Route\Get('/user', UserController::class);
new Route\Put('/user', User\SaveController::class);
new Route\Delete('/user/delete/{id}', User\DeleteController::class);
new Route\Delete('/user/delete/all', User\CleanUpController::class);
```

Route `DELETE:/user/delete/{id}` has a parameter `id` and that means this route will match to this requests (all of them has **DELETE** method request):

```
example.com/user/delete/1
example.com/user/delete/4
example.com/user/delete/nsgfg3
example.com/user/delete/...
```

but request `example.com/user/delete/all` will be match to route `DELETE:/user/delete/all`. You don't have to care about order of defining routes, constant path are always before "parameters" path.

If your controller class has any dependencies you can put them to array as third parameter:

```
$postRepository = new Repository\Post\Pdo(...);
$mailer = new Mailer\Swift(...);

new Route\Put(
    '/post',
    PostController::class,
    [
        $postRepository,
        'some_string_parameter',
        $mailer,
    ]
);
```

To extract parameters from Uri path call the method `Route::extractParameters($uriPath)`:

```
$route = new Route\Get('/post/{id}/{action}', PostController::class);

$parameters = $route->extractParameters('/post/3/show');

var_dump($parameters);

// array(2) {
//   'id' => string(1) "3"
//   'action' => string(4) "show"
// }
```

You can validate your parameters during extracting them from path:

```
$route = new Route\Get(
    '/post/{id}/{action}/{language}',
    PostController::class,
    [],
    [
        'id' => function (string $id): int {
            return (int) $id;
        },
        'action' => function (string $action): string {
            return $action . '.php';
        }
    ]
);

$parameters = $route->extractParameters('/post/3/show/pl');

var_dump($parameters);

// array(2) {
//   'id' => int(3)
//   'action' => string(8) "show.php"
//   'language' => string(2) "pl"
// }
```

### New request method route

[](#new-request-method-route)

If you want to add new request method route you have to create new class and extends `\eXtalion\Component\Routing\Route`.

Router (\\Basic)
----------------

[](#router-basic)

It's a class which handle a `\Psr\Http\Message\RequestInterface` and return `Route` which match to requested method and Uri path.

### Example

[](#example-1)

```
use eXtalion\Component\Routing\Router;

$router = new Router\Basic(
    new Route\Get(...),
    new Route\Get(...),
    new Route\Post(...),
    ...
);

$request = ... // Something what return \Psr\Http\Message\RequestInterface

$route = $router->handle($request);
```

If you try to add two routes which match exactly to the same Uri Path, `\eXtalion\Component\Routing\Exception\RouteConflict` will be thrown.

```
try {
    $router = new Router\Basic(
        new Route\Get('/user/{id}', ...),
        new Route\Get('/user/{login}', ...)
    );
} catch (RouteConflict $ex) {
    echo $ex->getMessage();
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

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

3128d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9dbae32495a7944e5369005d48c1c687c1ed9a965c6d24cfe65bff54ad3ce6f0?d=identicon)[d0niek](/maintainers/d0niek)

---

Top Contributors

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

---

Tags

phpphp71routinguri-path

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.3k86.3M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[aimeos/aimeos-core

Full-featured e-commerce components for high performance online shops

4.5k346.9k48](/packages/aimeos-aimeos-core)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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