{"id":13828086,"url":"https://github.com/ergebnis/http-method","last_synced_at":"2025-04-06T20:12:10.584Z","repository":{"id":38237818,"uuid":"193914005","full_name":"ergebnis/http-method","owner":"ergebnis","description":"📟 Provides a composer package with constants for HTTP request methods.","archived":false,"fork":false,"pushed_at":"2024-05-27T21:52:31.000Z","size":3133,"stargazers_count":90,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-28T07:53:46.887Z","etag":null,"topics":["http","method","request"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ergebnis.png","metadata":{"funding":{"github":["ergebnis","localheinz"]},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-26T13:50:37.000Z","updated_at":"2024-05-30T00:29:24.422Z","dependencies_parsed_at":"2024-03-01T22:27:23.158Z","dependency_job_id":"4235ebf5-79b9-4341-93a0-0b5b6d899d06","html_url":"https://github.com/ergebnis/http-method","commit_stats":{"total_commits":555,"total_committers":4,"mean_commits":138.75,"dds":0.4162162162162162,"last_synced_commit":"e3da59e999bce859e80c5ad70f08ccc0826c66ca"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":"ergebnis/php-package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fhttp-method","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fhttp-method/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fhttp-method/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fhttp-method/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ergebnis","download_url":"https://codeload.github.com/ergebnis/http-method/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543593,"owners_count":20955865,"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":["http","method","request"],"created_at":"2024-08-04T09:02:31.762Z","updated_at":"2025-04-06T20:12:10.556Z","avatar_url":"https://github.com/ergebnis.png","language":"PHP","readme":"# http-method\n\n[![Integrate](https://github.com/ergebnis/http-method/workflows/Integrate/badge.svg)](https://github.com/ergebnis/http-method/actions)\n[![Merge](https://github.com/ergebnis/http-method/workflows/Merge/badge.svg)](https://github.com/ergebnis/http-method/actions)\n[![Release](https://github.com/ergebnis/http-method/workflows/Release/badge.svg)](https://github.com/ergebnis/http-method/actions)\n[![Renew](https://github.com/ergebnis/http-method/workflows/Renew/badge.svg)](https://github.com/ergebnis/http-method/actions)\n\n[![Code Coverage](https://codecov.io/gh/ergebnis/http-method/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/http-method)\n\n[![Latest Stable Version](https://poser.pugx.org/ergebnis/http-method/v/stable)](https://packagist.org/packages/ergebnis/http-method)\n[![Total Downloads](https://poser.pugx.org/ergebnis/http-method/downloads)](https://packagist.org/packages/ergebnis/http-method)\n[![Monthly Downloads](http://poser.pugx.org/ergebnis/http-method/d/monthly)](https://packagist.org/packages/ergebnis/http-method)\n\nThis project provides a [`composer`](https://getcomposer.org) package with constants for HTTP request methods.\n\n## Motivation\n\nSeveral PHP frameworks and packages come with their own abstractions of HTTP request and response objects. Some of them provide constants for\n\n- HTTP request method names\n- HTTP response status codes\n\nso that a developer can refer to these by using named constants instead of magic numbers or magic strings.\n\nHere are a few examples of HTTP request abstractions which provide constants for HTTP request methods:\n\n- [`Symfony\\Component\\HttpFoundation\\Request`](https://github.com/symfony/http-foundation/blob/v4.3.2/Request.php#L41-L50)\n- [`Zend\\Http\\Request`](https://github.com/zendframework/zend-http/blob/release-2.10.0/src/Request.php#L26-L35)\n\nHere are a few examples of HTTP response abstractions which provide constants for HTTP response status codes:\n\n- [`Symfony\\Component\\HttpFoundation\\Response`](https://github.com/symfony/http-foundation/blob/v4.3.2/Response.php#L21-L88)\n- [`Zend\\Http\\Response`](https://github.com/zendframework/zend-http/blob/release-2.10.0/src/Response.php#L24-L88)\n\nHere are a few examples of interfaces providing constants for HTTP request methods and HTTP response status codes:\n\n- [`Fig\\Http\\Message\\RequestMethodInterface`](https://github.com/php-fig/http-message-util/blob/1.1.3/src/RequestMethodInterface.php#L24-L33)\n- [`Fig\\Http\\Message\\StatusCodeInterface`](https://github.com/php-fig/http-message-util/blob/1.1.3/src/StatusCodeInterface.php#L39-L106)\n\nHowever, a developer might use an abstraction that either does not provide any constants at all, or only provides a subset of the constants required for the specific case.\n\nThe excellent library [`teapot/status-code`](https://github.com/teapot-php/status-code) already provides HTTP status codes that are standardized by RFCs, as well as a range of vendor-specific HTTP status codes.\n\nIn a similar fashion, this library here aims to provide a collection of interfaces with constants for HTTP request methods that are standardized by RFCs, as well as additional vendor-specific HTTP request methods.\n\n## Installation\n\nRun\n\n```sh\ncomposer require ergebnis/http-method\n```\n\n## Usage\n\nThe interface [`Ergebnis\\Http\\Method`](/src/Method.php) provides constants for all of the HTTP request methods that are standardized by\n\n- [RFC 5789](https://tools.ietf.org/html/rfc5789)\n- [RFC 7231](https://tools.ietf.org/html/rfc7231)\n\nnamely\n\n- `CONNECT`\n- `DELETE`\n- `GET`\n- `HEAD`\n- `OPTIONS`\n- `PATCH`\n- `POST`\n- `PUT`\n- `TRACE`\n\nThe interface [`Ergebnis\\Http\\Method\\WebDav`](/src/Method/WebDav.php) provides constants for all of the HTTP request methods that are standardized by\n\n- [RFC 3648](https://tools.ietf.org/html/rfc3648)\n- [RFC 3744](https://tools.ietf.org/html/rfc3744)\n- [RFC 4437](https://tools.ietf.org/html/rfc4437)\n- [RFC 4791](https://tools.ietf.org/html/rfc4791)\n- [RFC 4918](https://tools.ietf.org/html/rfc4918)\n- [RFC 5323](https://tools.ietf.org/html/rfc5323)\n- [RFC 5789](https://tools.ietf.org/html/rfc5789)\n- [RFC 5842](https://tools.ietf.org/html/rfc5842)\n- [RFC 7231](https://tools.ietf.org/html/rfc7231)\n\nnamely\n\n- `ACL`\n- `BIND`\n- `CONNECT`\n- `COPY`\n- `DELETE`\n- `GET`\n- `HEAD`\n- `LOCK`\n- `MKCALENDAR`\n- `MKCOL`\n- `MKREDIRECTREF`\n- `MOVE`\n- `OPTIONS`\n- `ORDERPATCH`\n- `PATCH`\n- `POST`\n- `PROPFIND`\n- `PROPPATCH`\n- `PUT`\n- `REBIND`\n- `SEARCH`\n- `TRACE`\n- `UNBIND`\n- `UNLOCK`\n- `UPDATEREDIRECTREF`\n\nThe interface [`Ergebnis\\Http\\Method\\Vendor\\SquidCache`](/src/Method/Vendor/SquidCache.php) provides constants for a suggest HTTP request method used for purging items from the cache,\nnamely\n\n- `PURGE`\n\nThe interface [`Ergebnis\\Http\\Method\\Vendor\\VarnishCache`](/src/Method/Vendor/VarnishCache.php) provides constants for a suggest HTTP request method used for invalidating and purging items from the cache, namely\n\n- `BAN`\n- `PURGE`\n\nTo use these constants, import the interfaces and refer to the constants instead of using magic strings:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nuse Ergebnis\\Http\\Method;\nuse Psr\\Http\\Client;\nuse Psr\\Http\\Message;\n\n/** @var Message\\RequestFactoryInterface $requestFactory */\n$request = $requestFactory-\u003ecreate(\n    Method::GET,\n    'https://localheinz.com/articles/'\n);\n\n/** @var Client\\ClientInterface $httpClient */\n$httpClient-\u003esendRequest($request);\n```\n\n:bulb: If you are aware of any other - either standardized or vendor-specific - HTTP methods that are used in the wild, please let me know!\n\n## Changelog\n\nThe maintainers of this project record notable changes to this project in a [changelog](CHANGELOG.md).\n\n## Contributing\n\nThe maintainers of this project suggest following the [contribution guide](.github/CONTRIBUTING.md).\n\n## Code of Conduct\n\nThe maintainers of this project ask contributors to follow the [code of conduct](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).\n\n## General Support Policy\n\nThe maintainers of this project provide limited support.\n\nYou can support the maintenance of this project by [sponsoring @localheinz](https://github.com/sponsors/localheinz) or [requesting an invoice for services related to this project](mailto:am@localheinz.com?subject=ergebnis/http-method:%20Requesting%20invoice%20for%20services).\n\n## PHP Version Support Policy\n\nThis project supports PHP versions with [active and security support](https://www.php.net/supported-versions.php).\n\nThe maintainers of this project add support for a PHP version following its initial release and drop support for a PHP version when it has reached the end of security support.\n\n## Security Policy\n\nThis project has a [security policy](.github/SECURITY.md).\n\n## License\n\nThis project uses the [MIT license](LICENSE.md).\n\n## Social\n\nFollow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.\n","funding_links":["https://github.com/sponsors/ergebnis","https://github.com/sponsors/localheinz"],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergebnis%2Fhttp-method","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fergebnis%2Fhttp-method","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergebnis%2Fhttp-method/lists"}