PHPackages                             jpsistemasbr/router - 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. jpsistemasbr/router

ActiveLibrary[Framework](/categories/framework)

jpsistemasbr/router
===================

Sistema de Rotas PHP

021PHP

Since Nov 17Pushed 2y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Router @jpsistemasbr
====================

[](#router-jpsistemasbr)

###### Small, simple and uncomplicated. The router is a PHP route components with abstraction for MVC. Prepared with RESTfull verbs (GET, POST, PUT, PATCH and DELETE), works on its own layer in isolation and can be integrated without secrets to your application.

[](#small-simple-and-uncomplicated-the-router-is-a-php-route-components-with-abstraction-for-mvc-prepared-with-restfull-verbs-get-post-put-patch-and-delete-works-on-its-own-layer-in-isolation-and-can-be-integrated-without-secrets-to-your-application)

Pequeno, simples e descomplicado. O router é um componentes de rotas PHP com abstração para MVC. Preparado com verbos RESTfull (GET, POST, PUT, PATCH e DELETE), trabalha em sua própria camada de forma isolada e pode ser integrado sem segredos a sua aplicação.

### Highlights

[](#highlights)

- Router class with all RESTful verbs (Classe router com todos os verbos RESTful)
- Optimized dispatch with total decision control (Despacho otimizado com controle total de decisões)
- Requesting Spoofing for Local Verbalization (Falsificador (Spoofing) de requisição para verbalização local)
- It's very simple to create routes for your application or API (É muito simples criar rotas para sua aplicação ou API)
- Trigger and data carrier for the controller (Gatilho e transportador de dados para o controloador)
- Composer ready and PSR-2 compliant (Pronto para o composer e compatível com PSR-2)

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

[](#installation)

Router is available via Composer:

```
"jpsistemasbr/router": "1.0.*"
```

or run

```
composer require jpsistemasbr/router
```

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

[](#documentation)

###### For details on how to use the router, see the sample folder with details in the component directory. To use the router you need to redirect your route routing navigation (index.php) where all traffic must be handled. The example below shows how:

[](#for-details-on-how-to-use-the-router-see-the-sample-folder-with-details-in-the-component-directory-to-use-the-router-you-need-to-redirect-your-route-routing-navigation-indexphp-where-all-traffic-must-be-handled-the-example-below-shows-how)

Para mais detalhes sobre como usar o router, veja a pasta de exemplo com detalhes no diretório do componente. Para usar o router é preciso redirecionar sua navegação para o arquivo raiz de rotas (index.php) onde todo o tráfego deve ser tratado. O exemplo abaixo mostra como:

#### Apache

[](#apache)

```
RewriteEngine On
#Options All -Indexes

## ROUTER WWW Redirect.
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

## ROUTER HTTPS Redirect
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteCond %{HTTPS} off
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ROUTER URL Rewrite
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?route=/$1 [L,QSA]

```

#### Nginx

[](#nginx)

```
location / {
  if ($script_filename !~ "-f"){
    rewrite ^(.*)$ /index.php?route=/$1 break;
  }
}

```

##### Routes

[](#routes)

```
