asispts/http-accept
PHP parser for HTTP Accept, Accept-Language, Accept-Encoding, and Content-Type headers.
Maintainers
Requires
- php: ^7.2|^8.0
Requires (Dev)
- asispts/ptscs: ^1.0
- phpstan/phpstan: ^1.4
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^8.5|^9.5|^10.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
Apache-2.0 7beca5a724ef329bb5a0094b5aef7bfeab1193ae
- Asis Pattisahusiwa <asispts.woop@gmail.com>
accept-languageacceptcontent-typeaccept-encodinghttp-headershttp-header-parser
README
http-accept
ยป PHP parser for HTTP content negotiation headers ยซ
๐ Build
๐ License
๐ PHP Version
๐ Stable Version
๐ Downloads
http-accept is a PHP library for parsing HTTP headers used in content negotiation. It supports the following headers:
AcceptAccept-LanguageAccept-EncodingContent-Type
Parser classes are provided for each header, making it straightforward to extract information from incoming requests.
Installation
Install via Composer:
composer require asispts/http-accept
Usage
Use the corresponding parser class for each header.
Parse Content-Type
$contentType = (new ContentTypeParser())->parse($source);
Parse HTTP Accept
$types = (new AcceptParser())->parse($source);
Parse Accept-Language
$languages = (new AcceptLanguageParser())->parse($source);
Parse Accept-Encoding
$encodings = (new AcceptEncodingParser())->parse($source);
Contributing
Contributions are welcomeโwhether bug reports, feature requests, or pull requests. For major changes, please open an issue first to discuss your ideas.
License
Licensed under the Apache-2.0 License. See the LICENSE file for details.
