PHPackages                             franco2911/avrestirouter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. franco2911/avrestirouter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

franco2911/avrestirouter
========================

A fast and simple php router

1.0.0(1y ago)28MITPHPPHP ^8.3CI passing

Since Jun 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/fg-tec/avrestirouter)[ Packagist](https://packagist.org/packages/franco2911/avrestirouter)[ RSS](/packages/franco2911-avrestirouter/feed)WikiDiscussions master Synced 1mo ago

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

AvrestiRouter
=============

[](#avrestirouter)

[![PHP Composer](https://github.com/fg-tec/avrestirouter/actions/workflows/php.yml/badge.svg)](https://github.com/fg-tec/avrestirouter/actions/workflows/php.yml)

AvrestiRouter is a simple yet powerful PHP routing library inspired by Laravel. It provides an easy-to-use API for defining and resolving routes, handling different HTTP methods, and managing route groups with named parameters.

Features
--------

[](#features)

- Support for all HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Named route parameters for dynamic routing
- Grouped routes for better organization
- Custom regex patterns for route parameters

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

[](#requirements)

- PHP &gt;= 8.3

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

[](#installation)

You can install AvrestiRouter using Composer:

```
composer require franco2911/avrestirouter
```

Getting Started
---------------

[](#getting-started)

### Initialize AvrestiRouter

[](#initialize-avrestirouter)

First, initialize the `AvrestiRouter` and set it using the `Route` facade:

```
require 'vendor/autoload.php';

use AvrestiRouter\Routing\AvrestiRouter;
use AvrestiRouter\Routing\Facade\Route;

$router = new AvrestiRouter();
Route::setRouter($router);
```

### Defining Routes

[](#defining-routes)

You can define routes using the `Route` facade. Below are examples for various route definitions:

#### Basic Route

[](#basic-route)

```
Route::get('/contact', function () {
    return new \GuzzleHttp\Psr7\Response(200, [], "Contact page");
});
```

#### Named Route

[](#named-route)

```
Route::get('/about', function () {
    return new \GuzzleHttp\Psr7\Response(200, [], "About page");
})->name('about');
```

#### Grouped Routes

[](#grouped-routes)

```
Route::group(['group' => 'auth'], function () {
    Route::get('/dashboard', function () {
        return new \GuzzleHttp\Psr7\Response(200, [], "Dashboard");
    })->name('dashboard');

    Route::get('/settings', [\TestController::class, 'create'])->name('settings');

    Route::get('/profile/{id}', function ($id) {
        return new \GuzzleHttp\Psr7\Response(200, [], "Profile ID: $id");
    })->name('profile.show');
});
```

### Resolving Routes

[](#resolving-routes)

To resolve the current route based on the incoming request, use the `resolve` method. You can create a `ServerRequest` instance using Guzzle:

```
use GuzzleHttp\Psr7\ServerRequest;

$request = ServerRequest::fromGlobals();
$response = Route::resolve($request);

// Output the response body
echo $response->getBody();
```

### Generating URLs from Route Names

[](#generating-urls-from-route-names)

You can generate URLs for named routes using the `generateUrl` method:

```
echo Route::generateUrl('profile.show', ['id' => 1259]); // Output: /profile/1259
```

Example Usage
-------------

[](#example-usage)

You can find a complete example demonstrating the usage of AvrestiRouter in the example directory.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.

Contributions
-------------

[](#contributions)

Contributions are welcome! Please fork this repository and submit pull requests to contribute improvements or new features.

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance67

Regular maintenance activity

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.4% 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

686d ago

### Community

Maintainers

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

---

Top Contributors

[![Franco2911](https://avatars.githubusercontent.com/u/53708871?v=4)](https://github.com/Franco2911 "Franco2911 (27 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

phprouterSimplefast

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/franco2911-avrestirouter/health.svg)

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

###  Alternatives

[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[fab2s/souuid

Simple Ordered Uuid Generator in PHP

13573.2k1](/packages/fab2s-souuid)

PHPackages © 2026

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