Skip to content

Request: withMethod Example

Terry L edited this page Jun 20, 2020 · 3 revisions
Clone this wiki locally

Shieldon\Psr7\Request

Extends Message.

withMethod($method)

Return an instance with the provided HTTP method.

  • param string method * Case-sensitive method.
  • return static

Example:

$request = $request->withMethod('POST');
echo $request->getMethod();
// Outputs: POST