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

ActiveLibrary[Framework](/categories/framework)

hardjunior/router
=================

Um teste de composer de rota mvc, fast and extremely uncomplicated. Create and manage your routes in minutes!

v1.0.1(5y ago)035MITPHPPHP ^7.4

Since Dec 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hardjunior/router)[ Packagist](https://packagist.org/packages/hardjunior/router)[ Docs](http://www.hardjunior.ddns.net)[ RSS](/packages/hardjunior-router/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Router @hardjunior\_g11
=======================

[](#router-hardjunior_g11)

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

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

or run

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

```
