Öz MVC çärimizdä router ulanylmagy

index.php faýlynyň häzirki mazmunyny ýada salalyň:

index.php<?php
  namespace Core;
  
  error_reporting(E_ALL);
  ini_set('display_errors', 'on');
  
  spl_autoload_register(function($class) {
    // siziň awtogirlendirme amal etmäňiz
  });
  
  $routes = require $_SERVER['DOCUMENT_ROOT'] . '/project/config/routes.php';
?>

Indi index.php faýlynda routerymyzy aşakdaky ýaly ulanmak isleýäris:

index.php<?php
  $router = new Router();
  $track  = $router->getTrack($routes, $_SERVER['REQUEST_URI']);
?>

Has giňişleýin ýazmak bolýar:

index.php<?php
  $track = ( new Router ) -> getTrack($routes, $_SERVER['REQUEST_URI']);
?>