PHPackages                             devpontes/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. [Framework](/categories/framework)
4. /
5. devpontes/route

ActiveLibrary[Framework](/categories/framework)

devpontes/route
===============

Simples componente de rotas para projetos pequenos baseados em MVC

v3.0.0(8mo ago)332MITPHPPHP &gt;=8.0

Since Nov 22Pushed 8mo ago1 watchersCompare

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

READMEChangelog (6)DependenciesVersions (7)Used By (0)

Route by @Devpontes
===================

[](#route-by-devpontes)

[![Maintainer](https://camo.githubusercontent.com/7ef0ddd9aac702985e23a6325e735760100de8dbe95280d457515b3ca029d53b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61696e7461696e65722d406d6f692e706f6e7465732d626c75652e7376673f7374796c653d666c61742d737175617265)](https://instagram.com/moi.pontes)[![Source Code](https://camo.githubusercontent.com/2c0d9b37b8a09a3a385832af638a403064f693c5be82a769fa24a76ac74952a5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d6d6f69736573706f6e7465732f726f7574652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/moisespontes/route)[![PHP from Packagist](https://camo.githubusercontent.com/0e16a406a6957c030eb3a8dc5c16bbc25bc785992b07196f028a85405397057d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646576706f6e7465732f726f7574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devpontes/route)[![Latest Version](https://camo.githubusercontent.com/35bf6769d820e42d884d5db7bf07f8886de7bb3df8ddc7bd45675ce99cea80fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6d6f69736573706f6e7465732f726f7574652e7376673f7374796c653d666c61742d737175617265)](https://github.com/moisespontes/route/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build](https://camo.githubusercontent.com/01785e3272057453bf45c7d55b03add2b576627c255b463a1608353a1032938a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f6d6f69736573706f6e7465732f726f7574652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/moisespontes/route)[![Quality Score](https://camo.githubusercontent.com/63f303730555db37eab37c876d3adf08a146e2803cb43615e20bd122266d1e8d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d6f69736573706f6e7465732f726f7574652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/moisespontes/route)[![Total Downloads](https://camo.githubusercontent.com/24ad23d8050af358fb37d88bbbbc220d4c0ff96fb46461c499327a94c62fd8c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576706f6e7465732f726f7574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devpontes/route)

About Route componet
--------------------

[](#about-route-componet)

###### Route is a simple and lightweight route management component designed for small projects based on MVC architecture.

[](#route-is-a-simple-and-lightweight-route-management-component-designed-for-small-projects-based-on-mvc-architecture)

O Route é um componente simples e leve de gerenciamento de rotas, projetado para pequenos projetos baseados em arquitetura MVC.

### Highlights

[](#highlights)

- Suporte a rotas nomeadas. (named routes)
- Modo estrito para diferenciação de URLs. (strict mode)
- Configuração simples e intuitiva. (simple to set up)
- Padrão de rota: controller/method/{parameter}.

Instalação
----------

[](#instalação)

Installation is available through **Composer**:

```
"devpontes/route": "3.*"
```

or run

```
composer require devpontes/route
```

Documentation
-------------

[](#documentation)

### 1. Configuração

[](#1-configuração)

###### To use Route, all application requests must be redirected to the *index.php* file, which will act as the ***Front Controller***. Example using *Apache (.htaccess)*

[](#to-use-route-all-application-requests-must-be-redirected-to-the-indexphp-file-which-will-act-as-the-front-controller-example-using-apache-htaccess)

Para utilizar o Route, todas as requisições da aplicação devem ser redirecionadas para o arquivo *index.php*, que atuará como o ***Front Controller***. Exemplo usando o *Apache (.htaccess)*:

#### Apache

[](#apache)

```
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

```

### 2. Definição de Rotas

[](#2-definição-de-rotas)

###### Routes must be defined in an **array** in the format *\[path, controller@method\]*

[](#routes-must-be-defined-in-an-array-in-the-format-path-controllermethod)

As rotas devem ser definidas em um **array** no formato *\[path, controller@method\]*:

```
$routes = [
    ['/', 'Home@index'],
    ['/blog', 'Blog@index'],
    ['/contato', 'Contact@index'],
    ['/contato/{id}', 'Contact@index'],
    ['/not-found/404', 'Notfound@index'],
];
```

### 3. Captura da URL

[](#3-captura-da-url)

###### The request URL must be captured and passed to the component in the constructor or via the setter method.

[](#the-request-url-must-be-captured-and-passed-to-the-component-in-the-constructor-or-via-the-setter-method)

A URL da requisição deve ser capturada e passada ao componente no construtor ou via metodo setter. Exemplo com servidor *Apache*:

```
$url = $_GET['url'];
```

ou usando a pasta publica

```
$url = $_SERVER['REQUEST_URI'];
```

### 4. Inicialização

[](#4-inicialização)

###### On component initialization: 1 - Enter the routes array; 2 - Configure the controllers' namespace (the same as defined in *composer.json*); 3 - Run with the *run()* method.

[](#on-component-initialization-1---enter-the-routes-array-2---configure-the-controllers-namespace-the-same-as-defined-in-composerjson-3---run-with-the-run-method)

Na inicialização do componente:

1. Informe o array de rotas.
2. Configure o ***namespace*** dos controladores (mesmo definido no *composer.json*).
3. Execute com o método *run()*.

##### Usage

[](#usage)

```
$route = new \DevPontes\Route\Route($routes);
$route->setUrl($url);
$route->namespace("App\Controller");
$route->run();
```

### 5. Tratamento de Erros

[](#5-tratamento-de-erros)

###### To capture unconfigured routes, use the *fail* method

[](#to-capture-unconfigured-routes-use-the-fail-method)

Para capturar rotas não configuradas, utilize o método *fail*:

```
if ($route->fail()) {
    header('Location: /not-found/404');
}
```

### 6. Modo Estrito

[](#6-modo-estrito)

###### Strict mode differentiates between routes with and without trailing slashes.

[](#strict-mode-differentiates-between-routes-with-and-without-trailing-slashes)

O modo estrito diferencia rotas com e sem barra final. Exemplo:

- */sobre* ≠ */sobre/* (strict mode enabled).
- */sobre* = */sobre/* (strict mode disabled).

##### Enabling/disabling

[](#enablingdisabling)

```
$route->setStrictMode(true);
```

Credits
-------

[](#credits)

- [Moises Pontes](https://github.com/moisespontes) (Developer)

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance59

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Every ~202 days

Recently: every ~126 days

Total

6

Last Release

258d ago

Major Versions

v1.0.0 → v2.0.02024-04-15

v2.1.2 → v3.0.02025-09-02

PHP version history (3 changes)v1.0.0PHP &gt;=7.3

v2.1.1PHP &gt;=7.4

v3.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

routesrouterroutingrouteslin

### Embed Badge

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

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

###  Alternatives

[pecee/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

696214.6k17](/packages/pecee-simple-router)[izniburak/router

simple router class for php

23522.6k7](/packages/izniburak-router)[ecoal95/php-router

Minimal routing library

271.0k1](/packages/ecoal95-php-router)[developermarius/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

112.4k](/packages/developermarius-simple-router)

PHPackages © 2026

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