FyreHeader is a free, open-source immutable HTTP header library for PHP.
Using Composer
composer require fyre/header
In PHP:
use Fyre\Http\Header;
$name
is a string representing the header name.$value
is a string or array representing the header value.
$header = new Header($name, $value);
Append Value
Append a value to the header.
$value
is a string representing the value to append.
$newHeader = $header->appendValue($value);
Get Header String
Get the header string.
$headerString = $header->getHeaderString();
Get Name
Get the header name.
$name = $header->getName();
Get Value
Get the header value.
$value = $header->getValue();
Get Value String
Get the header value as a string.
$value = $header->getValueString();
Prepend Value
Prepend a value to the header.
$value
is a string representing the value to prepend.
$newHeader = $header->prependValue($value);
Set Value
Set the header value.
$value
is a string representing the header value.
$newHeader = $header->setValue($value);