PHP Classes

File: config/routes.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   PHP MVC Framework   config/routes.php   Download  
File: config/routes.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP MVC Framework
Example application using an MVC framework
Author: By
Last change:
Date: 1 month ago
Size: 551 bytes
 

Contents

Class file image Download
<?php

$router
= new Framework\Router;

// Homepage example
$router->add("/", ["controller" => "home", "action" => "index"]);

// Catch-all example
$router->add("/{controller}/{action}");

// Example with namespace
$router->add("/admin/{controller}/{action}", ["namespace" => "Admin"]);

// Example with HTTP method
$router->add("/{controller}/{id:\d+}/destroy", ["action" => "destroy", "method" => "post"]);

// Example with middleware
$router->add("/{controller}/{id:\d+}/show", ["action" => "show", "middleware" => "authneeded"]);

return
$router;