Application

What index.php is for?

The index.php file in this project, will forward the request into the Application instance which serves as the entry point in our Framework.

The request usually takes the following path

Request Path

The index.php file should include the routes.php files so that routes are created every time a requests arrives to the application.

<?php   // index.php
require_once "vendor/autoload.php";

use sirJuni\Framework\Application\Application;

require_once __DIR__ . "\\App\\routes.php";

$app = new Application();
$app->handle();
?>

$app contains an instance of Application class and when we call the $app->handle() method, the application passes the request into the Router and also passes an instance of Request class which is an abstraction or logical encapsulation of the current request.

Last updated