2017 © Pedro Peláez
 

library routing

More One Simple Router for PHP.

image

felipecwb/routing

More One Simple Router for PHP.

  • Sunday, January 18, 2015
  • by felipecwb
  • Repository
  • 2 Watchers
  • 5 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Routing

Build Status Latest Stable Version License, (*1)

More one simple Routing library for PHP., (*2)

You'll need know about Regex Patterns., (*3)

Instalation

Composer:, (*4)

{
    "felipecwb/routing": "dev-master"
}

Example:, (*5)

<?php

use Felipecwb\Routing\Router;
// Exceptions
use Felipecwb\Routing\Exception\ResolverException;
use Felipecwb\Routing\Exception\RouteNotFoundException;

$router = Router::create();

$router->add('/', function () {
    echo "Hello World!";
});

$router->add('/hello/(\w+)', function ($name) {
    echo "Hello {$name}!";
});

$router->add('/article/(\d+)', function ($id, $extraStr) {
    echo "Article {$id}! ${extraStr}";
});

try {
    $router->dispatch('/');
    // with arguments
    $router->dispatch('/hello/felipecwb');
    // with extra arguments
    $router->dispatch('/hello/10', ['Extra String!']);
} catch (RouteNotFoundException $e) {
    echo "Sorry! The target can not be found!";
} catch (ResolverException $e) {
    echo "Sorry! The target can not be executed!";
}

die;

Look in tests for more explanation, (*6)

Contributions

Feel free to contribute., (*7)

  1. Create a issue.
  2. Follow the PSR-2 and PSR-4
  3. PHPUnit to tests

License MIT, (*8)

The Versions

18/01 2015

dev-master

9999999-dev https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router

19/12 2014

dev-develop

dev-develop https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router

19/12 2014

v0.4

0.4.0.0 https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router

15/11 2014

0.3.3

0.3.3.0 https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router

06/11 2014

v0.3.2

0.3.2.0 https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router

06/11 2014

v0.3.1

0.3.1.0 https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router

05/11 2014

v0.2

0.2.0.0 https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router

05/11 2014

v0.1

0.1.0.0 https://github.com/felipecwb/Routing

More One Simple Router for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

routing router