class Method (View source)

Methods

__construct(bool $reset = false)

Create a Method instance

setAllowed(array $methods)

Defines which HTTP methods can be used to override the original method

addHeader(string $header, int $priority = 0)

Adds a request header as an alternative source for determining the HTTP method

addParam(string $param, int $priority = 0)

Adds a parameter (request body or querystring) as an alternative source for determining the HTTP method

string
__toString()

Get method from $_POST or $_GET or headers

static 
override()

Replaces $_SERVER['REQUEST_METHOD'] with the detected alternative method, using the default settings

static string
original()

Gets the original HTTP method of the request, before any overrides

Details

__construct(bool $reset = false)

Create a Method instance

Parameters

bool $reset

Optional. Reset sources

setAllowed(array $methods)

Defines which HTTP methods can be used to override the original method

Parameters

array $methods

addHeader(string $header, int $priority = 0)

Adds a request header as an alternative source for determining the HTTP method

Parameters

string $header
int $priority

addParam(string $param, int $priority = 0)

Adds a parameter (request body or querystring) as an alternative source for determining the HTTP method

Parameters

string $param
int $priority

string __toString()

Get method from $_POST or $_GET or headers

Return Value

string

static override()

Replaces $_SERVER['REQUEST_METHOD'] with the detected alternative method, using the default settings

static string original()

Gets the original HTTP method of the request, before any overrides

Return Value

string