Symfony2 API
Class

Symfony\Component\Security\Http\HttpUtils

class HttpUtils

Encapsulates the logic needed to create sub-requests, redirect the user, and match URLs.

Methods

__construct(UrlGeneratorInterface $urlGenerator = null, UrlMatcherInterface|RequestMatcherInterface $urlMatcher = null)

Constructor.

Response createRedirectResponse(Request $request, string $path, integer $status = 302)

Creates a redirect Response.

Request createRequest(Request $request, string $path)

Creates a Request.

Boolean checkRequestPath(Request $request, string $path)

Checks that a given path matches the Request.

string generateUri(Request $request, string $path)

Generates a URI, based on the given path or absolute URL.

Details

at line 40
public __construct(UrlGeneratorInterface $urlGenerator = null, UrlMatcherInterface|RequestMatcherInterface $urlMatcher = null)

Constructor.

Parameters

UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance
UrlMatcherInterface|RequestMatcherInterface $urlMatcher The Url or Request matcher

at line 58
public Response createRedirectResponse(Request $request, string $path, integer $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))
integer $status The status code

Return Value

Response A RedirectResponse instance

at line 71
public 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

Request A Request instance

at line 99
public Boolean 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

Boolean true if the path is the same as the one from the Request, false otherwise

at line 129
public 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

string An absolute URL