1. Go to this page and download the library: Download prismo-smartpro/router library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
prismo-smartpro / router example snippets
martPRO\Technology\Routers;
use SmartPRO\Technology\Middleware;
$router = new Routers();
$router->namespace("App\Controllers");
/*
* ROTAS DO SITE
*/
$router->resetMiddlewares();
$router->get("/", "Client:home");
$router->get("/product/{code}/{slug}", "Client:product");
$router->get("/category/{name}", "Client:categories");
/*
* ROTAS DO ADMIN
*/
$router->group("admin");
$router->get("/", "App:home");
$router->get("/users", "App:users");
$router->get("/register", function () {
//...
});
/*
* ROTAS DE API DO ADMIN
*/
$router->middleware([Middleware::class, "Auth"]);
$router->group("admin/api");
$router->post("/register", "App:register");
/*
* DISPARA A ROTA
*/
$router->dispatch();
if (!empty($router->error())) {
echo "<h1>Error: {$router->error()}</h1>";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.