Skip to content

A PHP library for working with HTTP and mail headers

Notifications You must be signed in to change notification settings

zachar-maximov/headers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

headers

A PHP library for working with HTTP and mail headers

Build Status

Install

composer require ivoba/headers

Version 2 requires minimum PHP7.1.

Usage

$headers = Headers::fromString(
'HTTP/1.1 200 OK
 Content-Length: 782420
 Content-Type: text/xml; charset=utf-8
 Server: Microsoft-HTTPAPI/2.0
 Date: Tue, 28 Nov 2017 16:08:41 GMT'
);

$reason = $headers->getStatusLine()->get(StatusLine::REASON_PHRASE); //OK
$server = $headers->getHeaders()->get('server'); //Microsoft-HTTPAPI/2.0

Tests

Install the dependencies via composer and run

vendor/bin/phpunit

Credits

This is a shameless port of https://github.com/ddeboer/headers which seems to be unmaintained.

About

A PHP library for working with HTTP and mail headers

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%