PHP Classes

File: src/helpers/helper_routes.php

Recommend this page to a friend!
  Classes of António Lira Fernandes   PHP Routes   src/helpers/helper_routes.php   Download  
File: src/helpers/helper_routes.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Routes
Route HTTP requests to controller classes
Author: By
Last change:
Date: 8 months ago
Size: 433 bytes
 

Contents

Class file image Download
<?php
use src\Route;
use
src\Request;

function
request(){
    return new
Request;
}


function
resolve($request = null){
    if(
is_null($request)) {
       
$request = request();
    }
    return
Route::resolve($request);
}


function
route($name, $params = null){
    return
Route::translate($name, $params);
}

function
redirect($pattern){
    return
resolve($pattern);
}

function
back(){
    return
header('Location: ' . $_SERVER['HTTP_REFERER']);
}

?>