Error: Uncaught Error: Class 'Route' not found in C: \ Users

0

I'm doing the PHP MVC course at School of Net, and I'm having this problem. I have already looked at the PHP documentation in version 7.2 but have not seen any significant changes.

I'm getting the following error: Fatal error: Uncaught Error: Class 'App \ Route' not found in C: \ Users \ Marcos Vinicius \ Desktop \ Projects \ php_whit_mvc \ course_mvc \ public \ index.php: 6 Stack trace: # 0 {main} thrown in C: \ Users \ Marcos Vinicius \ Desktop \ Projects \ php_whit_mvc \ course_mvc \ public \ index.php on line 6

My PHP 7.2 version

Course 7.0

Composer.json

   {
      "name": "son/mvc",
      "require": {
      "php": ">=5.6"
   },
      "authors": [
   {
      "name": "Guilherme Ferreira",
      "email": "[email protected]"
   }
 ]
}

Routes.php

    <?php
    namespace App;

    class Route
    {

    private $routes;

    public function initRoutes()
    {
        $routes['home'] = array('route' => '/', 'controller' => 'indexController', 'action' => 'index');
        $routes['contact'] = array('route' => '/contact', 'controller' => 'indexController', 'action' => 'contact');
    }

    public function getUrl()
    {
       return parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
    }
}

Index.php     

use App\Route;

$route = new Route();
echo $route->getUrl();
    
asked by anonymous 15.08.2018 / 19:29

0 answers