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

ActiveLibrary[Framework](/categories/framework)

aatis/routing
=============

Routing system of Aatis

2.1.0(9mo ago)01471PHPPHP &gt;=8.2

Since Dec 1Pushed 9mo ago1 watchersCompare

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

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

Aatis Routing
=============

[](#aatis-routing)

Advertisement
-------------

[](#advertisement)

This package is a part of `Aatis` and can't be used without the following packages :

- `aatis/dependency-injection` ()
- `aatis/template-renderer` ()
- `aatis/http-foundation` ()

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

[](#installation)

```
composer require aatis/routing
```

Usage
-----

[](#usage)

### Requirements

[](#requirements)

Add the `Router` service into the `Container`.

```
# In config/services.yaml file :

include_services:
  - 'Aatis\Routing\Service\Router'
```

You can give to this router arguments linked to your not found error page.

```
Aatis\Routing\Service\Router:
    arguments:
        notFoundErrorTemplate: 'path/to/your/template',
        notFoundErrorVars:
            template_var1: 404
            template_var2: "Page not found !"
```

Note

- notFoundErrorTemplate (default: /errors/error.tpl.php) is the path to your custom template for the 404 error page.
- notFoundErrorVars (default: \[\]) is an array of variables that you can use in your custom template. These variables will be pass to the vars parameter of the `TemplateRender`.

These arguments are optional

### Basic usage

[](#basic-usage)

The `Router` will handle the request and provide a response that corresponds to the route, thanks to severals controllers.

```
$response = $router->redirect($request);
```

Warning

By default, the `Response` provided are not prepared. You have to call the `prepare` method before sending the response.

### Controller

[](#controller)

A controller is a class that contains all your routes. Each must extends the abstract class `AbstractController`.

```
class AatisController extends AbstractController
{
    // ...
}
```

The `AbstractController` class provide a method `render` that allows you to render a template.

```
class AatisController extends AbstractController
{
    public function hello(): void
    {
        $this->render('template/path', [
            'template_var1' => 'Hello',
            'template_var2' => 'World !'
        ]);
    }
}
```

Into each controller, you have access to the `Container` :

```
class AatisController extends AbstractController
{
    public function hello(): void
    {
        $service = $this->container->get(Service::class);
    }
}
```

Caution

Despite its availability, this method is **not recommended**. Use autowiring instead (**see below**)

### Basic Routes

[](#basic-routes)

You can create routes into controllers like the following :

```
#[Route('/hello')]
public function hello(): void
{
    // ...
}
```

Note

You can give multiple `Route` to a same controller function

Caution

You **can't** give the same `Route` to multiple controller functions

### Routes with parameters

[](#routes-with-parameters)

You can give parameters to your routes :

```
#[Route('/hello/{name}/{age}')]
public function hello(string $name, int $age): void
{
    // ...
}
```

You can also have access to the `Request` object :

```
#[Route('/hello/{name}/{age}')]
public function hello(Request $request, string $name, int $age): void
{
    // ...
}
```

Finally, you can also autowire services / interfaces / env variables like into the constructor of a service thanks to the `DependencyInjection` package :

```
#[Route('/hello/{name}/{age}')]
public function hello(Service $service, string $name, int $age, ServiceInterface $serviceImplementingInterface): void
{
    // ...
}
```

### Route with method

[](#route-with-method)

You can also restrict the method of your route :

```
#[Route('/restricted', method: ['POST', 'DELETE'])]
public function restricted(): void
{
    // ...
}
```

Note

The method parameter is optional and set to empty by default (all methods are allowed)

### RequestStack

[](#requeststack)

To store the current `Request`, it is possible to put it into the `RequestStack` service.

```
$request = Request::createFromGlobals();
$requestStack = new RequestStack();

$requestStack->push($request);
```

With the `RequestStack`, the current `Request` is accessible from any service :

```
class MyService
{
    public function __construct(RequestStack $requestStack)
    {
        $this->request = $requestStack->getCurrentRequest();
    }
}
```

Caution

The use of the `RequestStack` is **not recommended**.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance57

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~87 days

Recently: every ~151 days

Total

8

Last Release

287d ago

Major Versions

0.1.1 → 1.0.02023-12-09

1.1.0 → 2.0.02024-10-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f62599db29152e0adf71ca1df468470b4d572bc556a4a634dc6c016157a5044?d=identicon)[Aatis](/maintainers/Aatis)

---

Top Contributors

[![BatMaxou](https://avatars.githubusercontent.com/u/90443919?v=4)](https://github.com/BatMaxou "BatMaxou (6 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/aatis-routing/health.svg)](https://phpackages.com/packages/aatis-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)
