2017 © Pedro Peláez
 

library routing

PHP Alchemy Routing Component

image

phpalchemy/routing

PHP Alchemy Routing Component

  • Wednesday, April 9, 2014
  • by phpalchemy
  • Repository
  • 1 Watchers
  • 2 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

README

Build Status, (*1)

Faster & simple Http Routing

This is a Simple but faster URL Http routing library, (*2)

Sample Use:, (*3)

use Alchemy\Component\Routing\Mapper;
use Alchemy\Component\Routing\Route;

$mapper = new Mapper();

$mapper->connect(
    'home_route',
    new Route(
        '/',
        array(
            '_controller' => 'sample',
            '_action' => 'index'
        )
    )
);

$mapper->connect(
    'to_index_route',
    new Route(
        '/{_controller}',
        array('_action' => 'index')
    )
);

$mapper->connect(
    'complete_route',
    new Route(
        '/{_controller}/{_action}'
    )
);

$mapper->connect(
    'complete_route',
    new Route(
        '/leap_year/{year}',  // pattern
        array(  // defaults
            '_controller' => 'Validator',
            '_action' => 'leapYear'
        ),
        array( // requeriments
            'year' => '\d+',
            '_method' => array('GET', 'POST')
        )
    )
);

print_r($mapper->match('/home/sample'));
Array
(
    [_controller] => home,
    [_action] => sample
)

print_r($mapper->match('/leap_year/2012'));
Array
(
    [_controller] => Validator,
    [_action] => leapYear,
    [year] => 2012,
)

The Versions

09/04 2014

dev-master

9999999-dev http://phpalchemy.org

PHP Alchemy Routing Component

  Sources   Download

MIT

The Requires

 

php routing

03/09 2013

v1.0

1.0.0.0 http://phpalchemy.org

PHP Alchemy Routing Component

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

php routing