Created
March 16, 2024 10:38
-
-
Save ugo-brocard/84b9cddc3c4491c40855d055b60819f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types = 1); | |
/** | |
* HTTP request methods. | |
* | |
* HTTP defines a set of request methods to indicate the desired action to be | |
* performed for a given resource. Although they can also be nouns, these | |
* request methods are sometimes referred as HTTP verbs. Each of them implements | |
* a different semantic, but some common features are shared by a group of them: | |
* e.g. a request method can be safe, idempotent, or cacheable. | |
*/ | |
enum HttpMethod: string | |
{ | |
/** | |
* The `GET` method requests a representation of the specified resource. | |
* Requests using GET should only retrieve data. | |
*/ | |
case Get = "GET"; | |
/** | |
* The `POST` method is used to submit an entity to the specified resource, | |
* often causing a change in state or side effects on the server. | |
*/ | |
case Post = "POST"; | |
/** | |
* The `PUT` method replaces all current representations of the target | |
* resource with the request payload. | |
*/ | |
case Put = "PUT"; | |
/** | |
* The PATCH method is used to apply partial modifications to a resource. | |
*/ | |
case Patch = "PATCH"; | |
/** | |
* The `DELETE` method deletes the specified resource. | |
*/ | |
case Delete = "DELETE"; | |
/** | |
* The `CONNECT` method establishes a tunnel to the server identified by the | |
* target resource. | |
*/ | |
case Connect = "CONNECT"; | |
/** | |
* The `HEAD` method asks for a response identical to that of a GET request, | |
* but without the response body. | |
*/ | |
case Head = "HEAD"; | |
/** | |
* The `OPTIONS` method is used to describe the communication options for the | |
* target resource. | |
*/ | |
case Options = "OPTIONS"; | |
/** | |
* The `TRACE` method performs a message loop-back test along the path to the | |
* target resource. | |
*/ | |
case Trace = "TRACE"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment