Implementation of Models in Your Own MVC Framework

The last thing we need to implement is working with models. To start, let's in the file index.php connect the file with database connection settings (let's place this connection at the top of the file):

index.php<?php
  namespace Core;
  
  error_reporting(E_ALL);
  ini_set('display_errors', 'on');
  
  require_once $_SERVER['DOCUMENT_ROOT'] . '/project/config/connection.php';
  
  ...
?>

The settings file contains PHP constants. After connecting the file, these constants will be available in all classes we call.