1. Go to this page and download the library: Download pjdietz/wellrested 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/ */
pjdietz / wellrested example snippets
use pjdietz\WellRESTed\Response;
use pjdietz\WellRESTed\Router;
e router with routes.
$router->add(
["/", "\\MyApi\\RootHandler"],
["/cats/", "\\MyApi\\CatHandler"],
["/dogs/*", "\\MyApi\\DogHandler"],
["/guinea-pigs/{id}", "\\MyApi\\GuineaPigHandler"],
["~/hamsters/([0-9]+)~", "\\MyApi\\HamsterHandler"]
);
// Output a response based on the request sent to the server.
$router->respond();