This is a PHP package providing an enum for the various HTTP response codes as found on Wikipedia.
composer require programster/http-codes
Below is an example of using the package to return a 404 JSON response for an API request.
<?php
use Programster\Http\HttpCode;
http_response_code(HttpCode::NOT_FOUND);
$body = [
"result" => "error",
"message" => "Resource not found.",
];
header('Content-Type: application/json');
die(json_encode($body));