HttpUtils
class HttpUtils
Encapsulates the logic needed to create sub-requests, redirect the user, and match URLs.
Methods
Details
Parameters
Exceptions
RedirectResponse
createRedirectResponse(Request $request, string $path, int $status = 302)
Creates a redirect Response.
Parameters
Request | $request | A Request instance |
string | $path | A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) |
int | $status | The status code |
Return Value
Request
createRequest(Request $request, string $path)
Creates a Request.
Parameters
Request | $request | The current Request instance |
string | $path | A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) |
Return Value
bool
checkRequestPath(Request $request, string $path)
Checks that a given path matches the Request.
Parameters
Request | $request | A Request instance |
string | $path | A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) |
Return Value
bool | true if the path is the same as the one from the Request, false otherwise |
string
generateUri(Request $request, string $path)
Generates a URI, based on the given path or absolute URL.
Parameters
Request | $request | A Request instance |
string | $path | A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) |
Return Value
Exceptions