perf/http-status

Allows to interact with HTTP status strings to be injected into HTTP headers.

3.1.0 2021-08-17 10:04 UTC

This package is auto-updated.

Last update: 2024-10-17 17:05:14 UTC


README

Allows to interact with HTTP status strings to be injected into HTTP headers.

Installation

composer require perf/http-status

Usage

Concrete calls

<?php

use perf\HttpStatus\HttpStatusRepository;

$repository = HttpStatusRepository::createDefault();

$httpStatus = $repository->get(404);

echo $httpStatus->getReason(); // Will print "Not Found"
echo $httpStatus->toHeader(); //  Will print "HTTP/1.1 404 Not Found"

Static calls

<?php

use perf\HttpStatus\HttpStatusRepository;

$httpStatus = HttpStatusRepository::createDefault()->get(404);

echo $httpStatus->getReason(); // Will print "Not Found"
echo $httpStatus->toHeader(); //  Will print "HTTP/1.1 404 Not Found"