PHP Classes

File: routes.php

Recommend this page to a friend!
  Classes of Vitalij Mik   PHP Router Class Package   routes.php   Download  
File: routes.php
Role: Configuration script
Content type: text/plain
Description: Configure the application URL patterns and controller classes
Class: PHP Router Class Package
Handle HTTP requests routing to controller classes
Author: By
Last change:
Date: 1 year ago
Size: 353 bytes
 

Contents

Class file image Download
<?php
require_once __DIR__ . '/IndexController.php';
require_once
__DIR__ . '/ProfileController.php';
$router = new Router();


$router->register('/', new IndexController());

$router->register('/profile/{id}', new ProfileController());

$router->register('/account/login', function (Request $request) {
    return
'Login';
},
'POST');


return
$router;