PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Simple, Fast, Lightweight PHP MVC Framework   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple, Fast, Lightweight PHP MVC Framework
Route requests to controller classes or closures
Author: By
Last change:
Date: 1 year ago
Size: 692 bytes
 

Contents

Class file image Download
<?php

use Pecee\SimpleRouter\SimpleRouter;

// Autoload the vendor
require_once __DIR__ . '/vendor/autoload.php';

// Load from environment variables.
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

define('ROOT', __DIR__);
define('VIEWS', __DIR__ . '/views');
define('ASSET_DIR', __DIR__ . '/assets');
define('BASE_DIR', isset($_ENV['BASE_DIR']) ? $_ENV['BASE_DIR'] : '');
define('URL', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . '/' . BASE_DIR);
define('ASSET_URL', URL . '/assets');

/* Load external routes file */
require_once 'routes/route.php';

SimpleRouter::setDefaultNamespace('\App\Controllers');
// Start the routing
SimpleRouter::start();