PHP Classes

File: public/index.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   PHP MVC Framework   public/index.php   Download  
File: public/index.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: 678 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

define("ROOT_PATH", dirname(__DIR__));

require
ROOT_PATH . "/vendor/autoload.php";

$dotenv = Dotenv\Dotenv::createImmutable(ROOT_PATH);

$dotenv->load();

set_error_handler("Framework\ErrorHandler::handleError");

set_exception_handler("Framework\ErrorHandler::handleException");

$router = require ROOT_PATH . "/config/routes.php";

$container = require ROOT_PATH . "/config/services.php";

$middleware = require ROOT_PATH . "/config/middleware.php";

$dispatcher = new Framework\Dispatcher($router, $container, $middleware);

$request = Framework\Request::createFromGlobals();

$response = $dispatcher->handle($request);

$response->send();