2017 © Pedro Peláez
 

library puja-route

Puja-Route is a router component, that allow to parse request to module/controller/action

image

jinnguyen/puja-route

Puja-Route is a router component, that allow to parse request to module/controller/action

  • Saturday, November 25, 2017
  • by jinnguyen
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

puja-route

Puja-Route is a router component, that allow to parse request to module/controller/action, (*1)

Install, (*2)

composer require jinnguyen/puja-route

Usage, (*3)

include /path/to/vendor/autoload.php;
$config = array(
    'root_namespace' => '\\Puja\\Route\\Demo\\', // You can change to match with controller class name on your app
    'default_controller' => 'Index', // Default controller
    'default_action' => 'index', // Default action
    'controller_dir' => __DIR__ . '/Controller/', // Folder that includes controllers, controller must have prefix is Controller and file type is .php (Ex:  UserController.php/IndexController.php, ...)
    'module_dir' => __DIR__ . '/Module/', // Folder that includes app modules
    'cache_dir' => __DIR__ . '/cache/', // Cache folder will store cached routers
);

$router = new Puja\Route\Route($config); // when you build, it will scan all file *Controller.php in $config[controller_dir] and /Controller/*Controller.php in $config[module_dir]

Add more route, (*4)

If your controller is not in $config[controller_dir] and $config[module_dir]//Controller/, you can also add it to route by this command:, (*5)

$route->addRoute('/testaddroute', '\\Test\\Add\\Route\\Namespace');

Build, (*6)

Scan all controller files and build routes from $config[controller_dir] and $config[module_dir] and controllers that was added by $router->addRoute(), (*7)

$router->build();

Get route, (*8)

Get router information: module, controller, action, .., (*9)

$router->getRoute('testaddroute') // get route at  of testaddroute

Note: - $router->getRoute() must run after $router->build() otherwise it will get exception - Should call $router->build() after all $router->addRoute(), otherwise all added routes will be missed., (*10)

The Versions

25/11 2017

dev-master

9999999-dev

Puja-Route is a router component, that allow to parse request to module/controller/action

  Sources   Download

Apache License 2.0

The Requires

 

by Jin Nguyen

route puja

25/11 2017

v1.2.1

1.2.1.0

Puja-Route is a router component, that allow to parse request to module/controller/action

  Sources   Download

Apache License 2.0

The Requires

 

by Jin Nguyen

route puja

23/11 2017

v1.2.0

1.2.0.0

Puja-Route is a router component, that allow to parse request to module/controller/action

  Sources   Download

Apache License 2.0

The Requires

 

by Jin Nguyen

route puja

24/02 2017

v1.1.0

1.1.0.0

Puja-Route is a router component, that allow to parse request to module/controller/action

  Sources   Download

Apache License 2.0

The Requires

 

by Jin Nguyen

route puja

21/02 2017

v1.0.0

1.0.0.0

Puja-Route is a router component, that allow to parse request to module/controller/action

  Sources   Download

Apache License 2.0

The Requires

 

by Jin Nguyen

route puja