36 if ($request->
getMethod() ===
'OPTIONS') {
44 case 'application/json':
49 case 'application/xml':
61 $body =
new Body(
fopen(
'php://temp',
'r+'));
63 $allow = implode(
', ', $methods);
68 ->withHeader(
'Allow', $allow)
80 $allow = implode(
', ', $methods);
82 return 'Allowed methods: ' . $allow;
93 $allow = implode(
', ', $methods);
95 return '{"message":"Method not allowed. Must be one of: ' . $allow .
'"}';
106 $allow = implode(
', ', $methods);
108 return "<root><message>Method not allowed. Must be one of: $allow</message></root>";
119 $allow = implode(
', ', $methods);
123 <title>
Method not allowed</title>
128 font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;
139 <h1>
Method not allowed</h1>
getMethod()
Retrieves the HTTP method of the request.
Representation of an incoming, server-side HTTP request.
foreach($paths as $path) $request
renderXmlNotAllowedMessage($methods)
Render XML not allowed message.
withStatus($code, $reasonPhrase='')
Return an instance with the specified status code and, optionally, reason phrase. ...
renderPlainOptionsMessage($methods)
Render PLAIN message for OPTIONS response.
determineContentType(ServerRequestInterface $request)
Determine which content type we know about is wanted using Accept header.
renderHtmlNotAllowedMessage($methods)
Render HTML not allowed message.
__invoke(ServerRequestInterface $request, ResponseInterface $response, array $methods)
Invoke error handler.
Representation of an outgoing, server-side response.
renderJsonNotAllowedMessage($methods)
Render JSON not allowed message.
if($path[strlen($path) - 1]==='/') if(is_dir($path)) if(!file_exists($path)) if(preg_match('#\.php$#D', mb_strtolower($path, 'UTF-8'))) $contentType
Slim Framework (https://slimframework.com)
Default Slim application not allowed handler.
Abstract Slim application handler.