1. Go to this page and download the library: Download gp/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/ */
gp / router example snippets
use Router\Request;
use Router\Response;
class APIController
{
private $req;
private $res;
public function __construct(Request $request, Response $res)
{
$this->req = $request;
$this->res = $response;
}
.....
}
use Router\Request;
use Router\Response;
class APIController
{
public function getPage(Request $req, Response $res, int $id)
{
.....
}
.....
}