marrios/mareaturborouter

v0.2.1 2024-05-22 12:39 UTC

This package is auto-updated.

Last update: 2024-11-14 14:31:19 UTC


README

PHP Version 8.1^

VRUMMMMMMMMMMMMMMMM

Total Downloads Latest Stable Version License

@marriosdev


Starting

composer require marrios/mareaturborouter

Copy

<?php

require_once("vendor/autoload.php");

use MareaTurbo\Router;

use MareaTurbo\Route;

class ControllerTeste
{
    public function __construct()
    {}

    #[Route("/teste/{id}", "GET", "route.name")]
    public function teste($request)
    {
        // get all parameters
        $request->all();

        // get only id parameter
        echo $request->only(["id"])['id'];
    }
}

// Register  controllers
(new Router())->controllers([
    ControllerTeste::class
]);

In your browser, access the URL: http://localhost/teste/123
And you will see the result: 123


You can run this route in CLI mode

php .\index.php GET /teste/123