1. Go to this page and download the library: Download basecode/route 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/ */
basecode / route example snippets
define("DS", DIRECTORY_SEPARATOR);
define("DOMAIN", "https://localhost/project");
ntroller_method [string] [optional] [default] = ":"
$route = new Route(domain_url, separator_controller_method);
# EXAMPLE
$route = new Route(DOMAIN, ":");
*/
$route = new Route(DOMAIN);
/*
route [string] [|function]
$route->standard(action);
# EXAMPLE
$route->get("admin/login", function() {
echo "<h1>ADMIN LOGIN</h1>";
}, "admin.login");
*/
$route->get("/", function() {
echo "<h1>HOME PAGE</h1>";
}, "home");
$route->namespace("Controllers\\Admin")->group("admin");
$route->get("/", "Controller:login", "admin.login");
// get route to namespace: Controllers\Admin\Controller - method: login
$route->execute();
/*
or
$route->execute("route"); // route is the name received by $_GET
*/