PHP code example of nattreid / routing

1. Go to this page and download the library: Download nattreid/routing library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nattreid / routing example snippets


class FrontRouter extends \NAttreid\Routing\Router {

    public function __construct($url, PagesRepository $pageModel) {
        parent::__construct($url);
    }

    public function createRoutes() {
        $routes = $this->getRouter('Front');

        $routes[] = new Route($this->url, 'Homepage:default');
        $routes[] = new Route($this->url . 'index.php', 'Page:default', Route::ONE_WAY);
        $routes[] = new Route($this->url . '<presenter>[/<action>]', 'Page:default');
    }

}