fyre / header
A HTTP header library.
v2.0.10
2024-10-30 11:25 UTC
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.59
- fyre/php-cs-fixer-config: ^1.0
- phpunit/phpunit: ^11
README
FyreHeader is a free, open-source immutable HTTP header library for PHP.
Table Of Contents
Installation
Using Composer
composer require fyre/header
In PHP:
use Fyre\Http\Header;
Basic Usage
$name
is a string representing the header name.$value
is a string or array representing the header value.
$header = new Header($name, $value);
Methods
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);