MethodNotAllowedHttpException#

Meritum\Http\Exception\MethodNotAllowedHttpException

Extends HttpException . Represents a 405 Method Not Allowed response.

Constructor#

public function __construct(
    ServerRequestInterface $request,
    string $message = '',
    array $allowedMethods = [],
    ?Throwable $previous = null
)

$allowedMethods is a string[] of HTTP methods that are valid for the route. Stored on the public $allowedMethods property.

use Meritum\Http\Exception\MethodNotAllowedHttpException;

throw new MethodNotAllowedHttpException($request, '', ['GET', 'HEAD']);
Property Value
Status 405
Title Method Not Allowed