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

ActiveLibrary[Framework](/categories/framework)

wallygator/router
=================

A classic Wallygator Router is easy, fast and extremely uncomplicated. Create and manage your routes in minutes!

1.0.7(6y ago)025MITPHPPHP ^7.2

Since Oct 3Pushed 2y agoCompare

[ Source](https://github.com/luizservelo/router)[ Packagist](https://packagist.org/packages/wallygator/router)[ Docs](http://www.upinside.com.br)[ RSS](/packages/wallygator-router/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (10)Used By (0)

Router @Wallygator
==================

[](#router-wallygator)

Forked from @Coffeecode/Router
------------------------------

[](#forked-from-coffeecoderouter)

###### 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.

About CoffeeCode
----------------

[](#about-coffeecode)

###### CoffeeCode is a set of small and optimized PHP components for common tasks. Held by Robson V. Leite and the UpInside team. With them you perform routine tasks with fewer lines, writing less and doing much more.

[](#coffeecode-is-a-set-of-small-and-optimized-php-components-for-common-tasks-held-by-robson-v-leite-and-the-upinside-team-with-them-you-perform-routine-tasks-with-fewer-lines-writing-less-and-doing-much-more)

CoffeeCode é um conjunto de pequenos e otimizados componentes PHP para tarefas comuns. Mantido por Robson V. Leite e a equipe UpInside. Com eles você executa tarefas rotineiras com poucas linhas, escrevendo menos e fazendo muito mais.

### 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:

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

or run

```
composer require coffeecode/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)

```
