{"id":14966424,"url":"https://github.com/yiisoft/http","last_synced_at":"2025-06-22T11:33:02.990Z","repository":{"id":36938357,"uuid":"231791923","full_name":"yiisoft/http","owner":"yiisoft","description":"Handy HTTP utility such as method constants and status codes","archived":false,"fork":false,"pushed_at":"2025-05-16T05:25:58.000Z","size":134,"stargazers_count":26,"open_issues_count":2,"forks_count":9,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-06-10T08:43:24.823Z","etag":null,"topics":["hacktoberfest","header","http","method","status","yii3"],"latest_commit_sha":null,"homepage":"https://www.yiiframework.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"yiisoft","github":["yiisoft"]}},"created_at":"2020-01-04T16:14:12.000Z","updated_at":"2025-05-16T05:26:01.000Z","dependencies_parsed_at":"2023-02-13T17:50:39.064Z","dependency_job_id":"90fb5676-4f60-4ae2-b8f1-bb20d29c3fa0","html_url":"https://github.com/yiisoft/http","commit_stats":{"total_commits":74,"total_committers":15,"mean_commits":4.933333333333334,"dds":"0.45945945945945943","last_synced_commit":"99781424896b8d03d17f0da2bd93fe17bd1a85a1"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":"yiisoft/package-template","purl":"pkg:github/yiisoft/http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fhttp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260081115,"owners_count":22956040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","header","http","method","status","yii3"],"created_at":"2024-09-24T13:36:21.944Z","updated_at":"2025-06-22T11:32:57.975Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://yiisoft.github.io/docs/images/yii_logo.svg\" height=\"100px\" alt=\"Yii\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii HTTP\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/http/v)](https://packagist.org/packages/yiisoft/http)\n[![Total Downloads](https://poser.pugx.org/yiisoft/http/downloads)](https://packagist.org/packages/yiisoft/http)\n[![Build status](https://github.com/yiisoft/http/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/http/actions/workflows/build.yml)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yiisoft/http/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/http/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/http/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/http/?branch=master)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fhttp%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/http/master)\n[![static analysis](https://github.com/yiisoft/http/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/http/actions?query=workflow%3A%22static+analysis%22)\n\nThe package provides:\n\n- Constants for HTTP protocol headers, methods and statuses. All along with short descriptions and RFC links.\n- PSR-7, PSR-17 PhpStorm meta for HTTP protocol headers, methods and statuses.\n- `ContentDispositionHeader` that has static methods to generate `Content-Disposition` header name and value.\n- `HeaderValueHelper` that has static methods to parse the header value parameters.\n\n## Requirements\n\n- PHP 7.4 or higher.\n\n## Installation\n\nThe package could be installed with [Composer](https://getcomposer.org):\n\n```shell\ncomposer require yiisoft/http\n```\n\n## Method constants\n\nIndividual HTTP methods could be referenced as\n\n```php\nuse Yiisoft\\Http\\Method;\n\nMethod::GET;\nMethod::POST;\nMethod::PUT;\nMethod::DELETE;\nMethod::PATCH;\nMethod::HEAD;\nMethod::OPTIONS;\n```\n\nTo have a list of these, use:\n\n```php\nuse Yiisoft\\Http\\Method;\n\nMethod::ALL;\n```\n\n## HTTP status codes\n\nStatus codes could be referenced by name as:\n\n```php\nuse Yiisoft\\Http\\Status;\n\nStatus::NOT_FOUND;\n```\n\nStatus text could be obtained as the following:\n\n```php\nuse Yiisoft\\Http\\Status;\n\nStatus::TEXTS[Status::NOT_FOUND];\n```\n\n## `ContentDispositionHeader` usage\n\n`ContentDispositionHeader` methods are static so usage is like the following:\n\n```php\nuse Yiisoft\\Http\\ContentDispositionHeader;\n\n$name = ContentDispositionHeader::name();\n\n$value = ContentDispositionHeader::value(\n    ContentDispositionHeader::INLINE,\n    'avatar.png',\n);\n\n$value = ContentDispositionHeader::inline('document.pdf');\n\n$value = ContentDispositionHeader::attachment('document.pdf');\n```\n\n## `HeaderValueHelper` usage\n\n`HeaderValueHelper` provides the following static methods:\n\n```php\nuse Yiisoft\\Http\\HeaderValueHelper;\n\n// Result: ['a' =\u003e '1', 'b' =\u003e '2']\nHeaderValueHelper::getParameters('a=1;b=2');\n\n// Result: ['value', 'a' =\u003e '1', 'b' =\u003e '2']\nHeaderValueHelper::getValueAndParameters('value;a=1;b=2'));\n\n// Result: [['value2', 'q' =\u003e 1.0], ['value1', 'q' =\u003e 0.2]]\nHeaderValueHelper::getSortedValueAndParameters('value1;q=0.2,value2'));\n\n// Result: ['text/xml', 'text/html']\nHeaderValueHelper::getSortedAcceptTypes('text/html;q=0.2,text/xml;q=0.4'));\n```\n\n## PSR-7 and PSR-17 PhpStorm meta\n\nThe package includes PhpStorm meta-files that help IDE to provide values when completing code in cases such as:\n\n```php\nuse Psr\\Http\\Message\\ResponseFactoryInterface;\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Yiisoft\\Http\\Header;\nuse Yiisoft\\Http\\Status;\n\nclass StaticController\n{\n    private ResponseFactoryInterface $responseFactory;\n\n    public function actionIndex(): ResponseInterface\n    {\n        return $this-\u003eresponseFactory\n            -\u003ecreateResponse()\n            -\u003ewithStatus(Status::OK)\n            -\u003ewithoutHeader(Header::ACCEPT);\n    }\n}\n```\n\n## Documentation\n\n- [Internals](docs/internals.md)\n\nIf you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for\nthat. You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).\n\n## License\n\nThe Yii HTTP is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n\nMaintained by [Yii Software](https://www.yiiframework.com/).\n\n## Support the project\n\n[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective\u0026logoColor=7eadf1\u0026labelColor=555555)](https://opencollective.com/yiisoft)\n\n## Follow updates\n\n[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)\n[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter\u0026logoColor=1DA1F2\u0026labelColor=555555?style=flat)](https://twitter.com/yiiframework)\n[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat\u0026logo=telegram)](https://t.me/yii3en)\n[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat\u0026logo=facebook\u0026logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)\n[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat\u0026logo=slack)](https://yiiframework.com/go/slack)\n","funding_links":["https://opencollective.com/yiisoft","https://github.com/sponsors/yiisoft"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Fhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fhttp/lists"}