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-12-17 17:32:19 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"