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

ActiveLibrary

kitsunecode/router
==================

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

v1.0.2(4y ago)023MITPHPPHP &gt;=7.2

Since Jul 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/enosfox/router)[ Packagist](https://packagist.org/packages/kitsunecode/router)[ Docs](http://www.masterkitsune.com)[ RSS](/packages/kitsunecode-router/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Router @KitsuneCode
===================

[](#router-kitsunecode)

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

[](#about-kitsunecode)

###### KitsuneCode is a set of small and optimized PHP components for common tasks. Held by Enos S. S. Silva and the Kitsune team. With them you perform routine tasks with fewer lines, writing less and doing much more.

[](#kitsunecode-is-a-set-of-small-and-optimized-php-components-for-common-tasks-held-by-enos-s-s-silva-and-the-kitsune-team-with-them-you-perform-routine-tasks-with-fewer-lines-writing-less-and-doing-much-more)

KitsuneCode é um conjunto de pequenos e otimizados componentes PHP para tarefas comuns. Mantido por Enos S. S. Silva e a equipe Kitsune. 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:

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

or run

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

```
