Class non détecter

Par tsaromino, il y a 3 ans


Bonjur j'ai un soucis au niveau d'un fichier qui ne trouve pas un classe ,pourant j'ai bien mon autoload;php qui fonctionne

Mon fichier public/index.php ( La class App/Routeur n'ets pas trouver )

<?php require '../vendor/autoload.php'; $router = new App\Router(dirname(__DIR__) . '/views'); $router->get('/blog', '/post/index', '/blog') ->get('/blog/category', '/category/show', '/category') ->run();

Mon fichier src/Routeur.php

namespace App; class Router { /** * @var string ; */ private $viewPath; /** * @var AltoRouteur */ private $router; public function __construct(string $viewPath){ $this->viewPath = $viewPath; $this->router = new \AltoRouter(); } public function get(string $url, string $view, ?string $name = null): self { $this->router->map('GET', $url, $view, $name); return $this; } public function run(): self{ $match = $this->router->match(); $view = $match['target']; require $this->viewPath . DIRECTORY_SEPARATOR . $view . '.php'; return $this; } }

Mon composer.json

{ "autoload": { "psr-4":{ "App\\": "src/" } }, "require": { "altorouter/altorouter": "1.2.0" } }

Aucune réponse