HttpMethod uses ConstantsTrait
Defines constants for common HTTP request methods.
Table of Contents
Constants
- ALL : string = 'ALL'
- all : string = 'all'
- CONNECT : string = 'CONNECT'
- connect : string = 'connect'
- count : string = 'count'
- default : string = 'default'
- DELETE : string = 'DELETE'
- delete : string = 'delete'
- deleteAll : string = 'deleteAll'
- exist : string = 'exist'
- flush : string = 'flush'
- GET : string = 'GET'
- get : string = 'get'
- HEAD : string = 'HEAD'
- head : string = 'head'
- insert : string = 'insert'
- list : string = 'list'
- OPTIONS : string = 'OPTIONS'
- options : string = 'options'
- PATCH : string = 'PATCH'
- patch : string = 'patch'
- POST : string = 'POST'
- post : string = 'post'
- PURGE : string = 'PURGE'
- purge : string = 'purge'
- PUT : string = 'PUT'
- put : string = 'put'
- replace : string = 'replace'
- TRACE : string = 'TRACE'
- trace : string = 'trace'
- truncate : string = 'truncate'
- update : string = 'update'
- upsert : string = 'upsert'
Methods
- isValid() : bool
- Checks whether a given HTTP method is a valid standard HTTP method.
Constants
ALL
public
string
ALL
= 'ALL'
all
public
string
all
= 'all'
CONNECT
public
string
CONNECT
= 'CONNECT'
connect
public
string
connect
= 'connect'
count
public
string
count
= 'count'
default
public
string
default
= 'default'
DELETE
public
string
DELETE
= 'DELETE'
delete
public
string
delete
= 'delete'
deleteAll
public
string
deleteAll
= 'deleteAll'
exist
public
string
exist
= 'exist'
flush
public
string
flush
= 'flush'
GET
public
string
GET
= 'GET'
get
public
string
get
= 'get'
HEAD
public
string
HEAD
= 'HEAD'
head
public
string
head
= 'head'
insert
public
string
insert
= 'insert'
list
public
string
list
= 'list'
OPTIONS
public
string
OPTIONS
= 'OPTIONS'
options
public
string
options
= 'options'
PATCH
public
string
PATCH
= 'PATCH'
patch
public
string
patch
= 'patch'
POST
public
string
POST
= 'POST'
post
public
string
post
= 'post'
PURGE
public
string
PURGE
= 'PURGE'
purge
public
string
purge
= 'purge'
PUT
public
string
PUT
= 'PUT'
put
public
string
put
= 'put'
replace
public
string
replace
= 'replace'
TRACE
public
string
TRACE
= 'TRACE'
trace
public
string
trace
= 'trace'
truncate
public
string
truncate
= 'truncate'
update
public
string
update
= 'update'
upsert
public
string
upsert
= 'upsert'
Methods
isValid()
Checks whether a given HTTP method is a valid standard HTTP method.
public
static isValid(string $method[, bool $caseSensitive = false ]) : bool
This method compares the input string against the list of recognized
HTTP methods (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE, CONNECT, PURGE).
By default, the check is case-insensitive, but you can enforce exact case
matching by setting $caseSensitive to true.
Parameters
- $method : string
-
The HTTP method to validate (e.g., 'GET', 'post').
- $caseSensitive : bool = false
-
Optional. Whether the match should be case-sensitive. Defaults to
false.
Tags
Return values
bool —Returns true if the method is a recognized HTTP method,
false otherwise.