1. Go to this page and download the library: Download anax/response 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/ */
anax / response example snippets
/**
* Configuration file for DI container.
*/
return [
// Services to add to the container.
"services" => [
"response" => [
"shared" => true,
//"callback" => "\Anax\Response\Response",
"callback" => function () {
$obj = new \Anax\Response\ResponseUtility();
$obj->setDI($this);
return $obj;
}
],
],
];
// Leave to router to match incoming request to routes
$response = $di->get("router")->handle(
$di->get("request")->getRoute(),
$di->get("request")->getMethod()
);
// Send the HTTP response with headers and body
$di->get("response")->send($response);