http-accept
is a PHP parser designed to handle HTTP headers related to content negotiation. These headers include Accept
, Accept-Language
, Accept-Encoding
, and Content-Type
. The library provides parser classes for each of these headers, making it easy to extract the relevant information from incoming HTTP requests.
You can install this library using composer.
composer require asispts/http-accept
To parse the different headers, use the corresponding parser class.
$contentType = (new ContentTypeParser())->parse($source);
$types = (new AcceptParser())->parse($source);
$languages = (new AcceptLanguageParser())->parse($source);
$encodings = (new AcceptEncodingParser())->parse($source);
All forms of contributions are welcome, including bug reports, feature requests, and pull requests. If you plan to make major changes, please open an issue first to discuss what you would like to change.
Released under Apache-2.0 License. See LICENSE file for more details.