0
Good morning, good afternoon or good night.
I am learning to use the Coffeecode Router component but it always returns me the 400 error regardless of the route I access, I did a search and did not find much, I use php 7.4.
This is my Index.php
<?php
require __DIR__ . "/vendor/autoload.php";
use CoffeeCode\Router\Router;
$router = new Router("http://localhost/Teste%20Mongo");
$router->namespace("Source/App");
//$router->group(null);
$router->get("/", "Web:index");
$router->group("ooops");
$router->get("/{errcode}", "Web:error");
$router->dispatch();
if ($router->error()) {
$router->redirect("/ooops/{$router->error()}");
}
My Controller, It is on the way Source/App/Web.php
<?php
namespace Source\App;
class Web
{
public function index($data)
{
echo 'Index';
}
public function error($data)
{
echo 'Error';
}
}
My Komposer.json
{
"require": {
"mongodb/mongodb": "^1.6",
"coffeecode/router": "^1.0"
},
"autoload": {
"psr-4": {
"Source\\App\\": "Source/App"
}
}
}