phpEZ v0.4.0

HTTP : string
in package

HTTP request method enum.

Represents standard HTTP verbs supported by the PHPEz API framework. Provides utilities to get the current request method and validate method types.

Tags
subpackage

http

see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods

Table of Contents

Cases

DELETE  = 'DELETE'
GET  = 'GET'
POST  = 'POST'
PUT  = 'PUT'
REPORT  = 'REPORT'

Methods

is()  : bool
Check if this HTTP method matches a given method or the current request method.
method()  : static
Get the HTTP method of the current request.

Cases

Methods

is()

Check if this HTTP method matches a given method or the current request method.

public is([string|null $meth = null ]) : bool

Usage:

if (HTTP::POST->is()) { ... }                    // Check if current is POST
if ($method->is(HTTP::GET->value)) { ... }      // Check if $method is GET
Parameters
$meth : string|null = null

Optional HTTP method value to compare against. If null, compares against the current request method.

Return values
bool

True if this method matches the given method or current request.

method()

Get the HTTP method of the current request.

public static method() : static
Tags
throws
never

Relies on $_SERVER['REQUEST_METHOD'] which is always set.

Return values
static

The HTTP method enum case for the current request.

On this page

Search results