From 114800f54cf777f061c316ee075080225234cd51 Mon Sep 17 00:00:00 2001 From: Asis Pattisahusiwa <79239132+asispts@users.noreply.github.com> Date: Fri, 28 Apr 2023 07:31:50 +0900 Subject: [PATCH 1/3] Remove composer validation in workflow --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1376bd8..8b060b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,9 +21,6 @@ jobs: php-version: ${{ matrix.php-versions }} coverage: none - - name: Validate composer.json and composer.lock - run: composer validate - - name: Get Composer Cache Directory id: composer-cache-dir run: | @@ -63,9 +60,6 @@ jobs: php-version: ${{ matrix.php-versions }} coverage: none - - name: Validate composer.json and composer.lock - run: composer validate - - name: Get Composer Cache Directory id: composer-cache-dir run: | From 57f9166374ad6fca5139d39982f746c918367cc9 Mon Sep 17 00:00:00 2001 From: Asis Pattisahusiwa <79239132+asispts@users.noreply.github.com> Date: Fri, 28 Apr 2023 09:47:31 +0900 Subject: [PATCH 2/3] Rename project and modify some informations --- composer.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 3b00fdf..4c92b44 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { - "name": "hnet/http-accept", - "description": "PHP Parser to deal with HTTP Accept, Accept-Language, Accept-Encoding, and Accept-Charset headers", + "name": "asispts/http-accept", + "description": "PHP Parser to deal with HTTP Accept, Accept-Language, Accept-Encoding, and Content-Type headers", "keywords": [ - "http", - "http accept", - "Accept", - "Accept-Language", - "Accept-Encoding", - "Accept-Charset" + "http-headers", + "http-header-parser", + "accept", + "accept-language", + "accept-encoding", + "content-type" ], "type": "library", "license": "Apache-2.0", @@ -35,18 +35,18 @@ "HttpAccept\\": "src" } }, + "autoload-dev": { + "psr-4": { + "HttpAccept\\Tests\\": "tests" + } + }, "require": { - "php": ">=7.2" + "php": "^7.2|^8.0" }, "require-dev": { "asispts/ptscs": "^1.0", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1.0", "phpunit/phpunit": "^8.5|^9.5" - }, - "extra": { - "branch-alias": { - "dev-master": "0.2-dev" - } } } From f1ea30228df9d18152967183a3b02e6f8c4d9486 Mon Sep 17 00:00:00 2001 From: Asis Pattisahusiwa <79239132+asispts@users.noreply.github.com> Date: Fri, 28 Apr 2023 10:26:33 +0900 Subject: [PATCH 3/3] Update readme --- README.md | 54 ++++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index d2b8b8d..e008983 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,40 @@ -# HTTP Accept -PHP Parser to deal with HTTP `Accept`, `Accept-Language`, `Accept-Encoding`, and `Accept-Charset` headers +[![Build](https://github.com/asispts/http-accept/actions/workflows/ci.yml/badge.svg)](https://github.com/asispts/http-accept/actions/workflows/ci.yml) +[![License](https://img.shields.io/github/license/asispts/http-accept)](./LICENSE) -[![Build](https://github.com/pattisahusiwa/http-accept/workflows/Build/badge.svg?branch=master)](https://github.com/pattisahusiwa/http-accept/actions) -[![License](https://img.shields.io/github/license/pattisahusiwa/http-accept)](https://github.com/pattisahusiwa/http-accept/blob/master/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 -Use [composer](https://getcomposer.org/) to install the library. +You can install this library using [composer](https://getcomposer.org/). ```bash -composer require hnet/http-accept +composer require asispts/http-accept ``` ## Usage +To parse the different headers, use the corresponding parser class. -## Changelog -See [CHANGELOG.md](https://github.com/pattisahusiwa/http-accept/blob/master/CHANGELOG.md) +### Parse `Content-Type` +```php +$contentType = (new ContentTypeParser())->parse($source); +``` +### Parse HTTP `Accept` +```php +$types = (new AcceptParser())->parse($source); +``` -## Contributing -All form of contributions are welcome. You can [report issues](https://github.com/pattisahusiwa/http-accept/issues), fork the repo and [submit pull requests](https://github.com/pattisahusiwa/http-accept/pulls). +### Parse `Accept-Language` +```php +$languages = (new AcceptLanguageParser())->parse($source); +``` -For major changes, please open an issue first to discuss what you would like to change. +### Parse `Accept-Encoding` +```php +$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](https://opensource.org/licenses/Apache-2.0). See [LICENSE](https://github.com/pattisahusiwa/http-accept/blob/master/LICENSE) file for more details. - -````txt -Copyright 2020 Asis Pattisahusiwa - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -```` +Released under [Apache-2.0 License](https://opensource.org/licenses/Apache-2.0). See [LICENSE](./LICENSE) file for more details.