PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Vitalij Mik   PHP Router Class Package   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Router Class Package
Handle HTTP requests routing to controller classes
Author: By
Last change:
Date: 1 year ago
Size: 321 bytes
 

Contents

Class file image Download
<?php
error_reporting
(E_ALL);

require_once
__DIR__ . '/Router.php';
require_once
__DIR__ . '/Request.php';

$router = require_once __DIR__ . '/routes.php';

$request = Request::createFromGlobal();

try{
    echo
$router->handle($request);
}catch (
RouteNotFoundException $exception){
    echo
$exception->getMessage();
}