windy/lazyrouter

Translates request URIs into method calls.

Installs: 27

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 2

Forks: 0

Open Issues: 0

Type:libary

pkg:composer/windy/lazyrouter

dev-master 2014-04-21 21:58 UTC

This package is not auto-updated.

Last update: 2025-12-20 21:47:05 UTC


README

Translate requests into method calls.

Composer

{
    "require": {
        "windy/lazyrouter": "dev-master"
    }
}

Example

Note: Make sure you redirect all requests to a single index.php.

An example index.php

<?php
require_once 'Router.php';
use lazyrouter\Router;

$router = new Router();
$router->route(function() {}, function() {});

A request such as 'hello/world' would be interpreted as.

require_once 'controllers/hello.php';
$controller = new hello();
$controller->world();

Namespaces are permitted as well. Something like 'foo/bar/baz' would be interpreted as.

require_once 'controllers/bar.php';
$controller = new foo\bar();
$controller->baz();