Skip to content
Pedro Santana edited this page Oct 27, 2015 · 1 revision

Custom Routing

With FlavorPHP you can add custom routing to your applictaions.

To handle a custom uri you need to add a router target in the router.php file, to catch the params of the uri you have to create a regex group by each param.

<?php
$this->add(string $route, mixed $target);
?>

When $route is a regex string and $target could be string or array with 'controller', 'action' and 'params' keys.

Example

<?php
$this->add("about", "index/about");
$this->add("tos", "index/tos");
$this->add("privacy", "index/privacy");
$this->add("signin", "index/signin");

$this->add("store/setup/name", "store/setup_name");
$this->add("store/setup/listings", "store/setup_listings");
$this->add("store/setup/payments", "store/setup_payments");
$this->add("store/setup/open", "store/setup_open");
?>
Clone this wiki locally