Fix: Add html() method to Response class

This commit is contained in:
Hamza-Ayed
2026-05-22 04:00:06 +03:00
parent 8448f13dfc
commit 317de3c122

View File

@@ -58,6 +58,25 @@ class Response
exit; exit;
} }
/**
* Send HTML response and terminate execution
*
* @param string $html
* @param int $code
* @return void
*/
public function html(string $html, int $code = 200): void
{
$this->setStatusCode($code);
$this->setHeader('Content-Type', 'text/html; charset=utf-8');
$this->sendHeaders();
http_response_code($this->statusCode);
echo $html;
exit;
}
/** /**
* Send success JSON response * Send success JSON response
*/ */