Mahdi Hasanpour [email protected]
Install library with Composer
composer require mhr/simple-restful
Create a php file that all incoming request rewrite to it file (e.g. with .htaccess and RewriteEngine ) with below codes.
<?php
require __DIR__ . '/vendor/autoload.php';
$core = new \SimpleRESTful\Core();
$core->addMiddleware(function ($next, \SimpleRESTful\HTTP\Response $response) {
$next();
$response->generateOutput();
});
$core->run();