Skip to content

PHP Parser to deal with HTTP Accept, Accept-Language, Accept-Encoding, and Content-Type headers

License

Notifications You must be signed in to change notification settings

asispts/http-accept

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7beca5a · Apr 28, 2023

History

70 Commits
Apr 28, 2023
Apr 28, 2023
Apr 28, 2023
Sep 2, 2021
Apr 12, 2023
Apr 28, 2023
Aug 26, 2020
Apr 28, 2023
Apr 28, 2023
Apr 12, 2023
Apr 28, 2023
Apr 12, 2023

Repository files navigation

Build Packagist PHP Version Packagist Version License

http-accept parser

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.

Installation

You can install this library using composer.

composer require asispts/http-accept

Usage

To parse the different headers, use the corresponding parser class.

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

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.

License

Released under Apache-2.0 License. See LICENSE file for more details.