helionogueir/routing

A libraty to control route for HTTP request

v1.0.0 2016-12-09 18:18 UTC

This package is not auto-updated.

Last update: 2024-05-06 10:42:49 UTC


README

A libraty to control route for HTTP request.

Installation

Composer (https://getcomposer.org/) and (https://packagist.org/)

composer require helionogueir/routing

Usage

helionogueir\routing\route\Factory

Load route.json file and construct a "helionogueir\routing\Route" object

use helionogueir\routing\route\Factory;
$namespace = "path/to/request";
$directory = "./routing/tests";
$route = Factory::byFile($namespace, $directory);

helionogueir\routing\server\Autoload

Define a new role for spl_autoload_register

use helionogueir\routing\server\Autoload;
(new Autoload())->registerRoot("./routing/core");

helionogueir\routing\Route

Construct a new "helionogueir\routing\Route" object

use helionogueir\routing\Route;
$request = "route";
$className = "helionogueir\\routing\\server\\Autoload";
$method = "registerRoot";
$route = new Route($request, $className, $method);
$className = $route->getClassName();
(new $className())->{$route->getMethod()}("./routing/core");

TDD (Test Driven Development)

PHPUnit (https://phpunit.de/)

phpunit -c ./routing/tests/unit.xml