PHP Classes

File: public/index.php

Recommend this page to a friend!
  Classes of Alfredo Rodriguez   Teo   public/index.php   Download  
File: public/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Teo
MVC Framework with configurable routes and filters
Author: By
Last change:
Date: 2 years ago
Size: 680 bytes
 

Contents

Class file image Download
<?php

/**
 * Front controller
 *
 * Requiere PHP7.3
 *
 * Desarrolla JARS Costa Rica
 * www.jarscr.com
 * Telefono: 4000-2528
 *
 * Programador: Alfredo Rodriguez
 *
 **/


/**
 * Composer
 */
require dirname(__DIR__) . '/vendor/autoload.php';


/**
 * Error and Exception handling
 */
error_reporting(E_ALL);
set_error_handler('Core\Error::errorHandler');
set_exception_handler('Core\Error::exceptionHandler');


/**
 * Routing
 */
$router = new Core\Router();

// Add the routes
$router->add('', ['controller' => 'Home', 'action' => 'index']);
$router->add('{controller}/{action}');

if (isset(
$_SERVER['QUERY_STRING'])) {
   
$router->dispatch($_SERVER['QUERY_STRING']);
}