- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Message: withAddedHeader Example
        Terry L edited this page Jun 20, 2020 
        ·
        3 revisions
      
    Shieldon\Psr7\Message
Return an instance with the specified header appended with the given value.
- 
param stringname*Case-insensitive header field name.
- 
param string|arrayvalue*Header value(s)
- 
return static
Existing values for the specified header will be maintained. The new value(s) will be appended to the existing list. If the header did not exist previously, it will be added.
Example:
$message = $message->withHeader('foo', 'bar');
echo $message->getHeaderLine('foo');
// Outputs: bar
$message = $message->withAddedHeader('foo', 'baz');
echo $message->getHeaderLine('foo');
// Outputs: bar
$message = $message->withAddedHeader('foo2', 'baz');
echo $message->getHeaderLine('foo2');
// Outputs: bazcomposer require shieldon/psr-httpShieldon PSR HTTP implementation written by Terry L. from Taiwan.
