Documentation

HttpUtils
in package

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

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Properties

$domainRegexp  : string|null
$secureDomainRegexp  : string|null
$urlGenerator  : mixed
$urlMatcher  : mixed

Methods

__construct()  : mixed
checkRequestPath()  : bool
Checks that a given path matches the Request.
createRedirectResponse()  : RedirectResponse
Creates a redirect Response.
createRequest()  : Request
Creates a Request.
generateUri()  : string
Generates a URI, based on the given path or absolute URL.

Properties

$domainRegexp

private string|null $domainRegexp

$secureDomainRegexp

private string|null $secureDomainRegexp

Methods

__construct()

public __construct([UrlGeneratorInterface $urlGenerator = null ][, UrlMatcherInterface|RequestMatcherInterface $urlMatcher = null ][,  $domainRegexp = null ][,  $secureDomainRegexp = null ]) : mixed
Parameters
$urlGenerator : UrlGeneratorInterface = null
$urlMatcher : UrlMatcherInterface|RequestMatcherInterface = null
$domainRegexp : = null

A regexp the target of HTTP redirections must match, scheme included

$secureDomainRegexp : = null

A regexp the target of HTTP redirections must match when the scheme is "https"

Tags
throws
InvalidArgumentException

checkRequestPath()

Checks that a given path matches the Request.

public checkRequestPath(Request $request, string $path) : bool
Parameters
$request : Request
$path : string

A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))

Return values
bool

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

createRedirectResponse()

Creates a redirect Response.

public createRedirectResponse(Request $request, string $path[, int $status = 302 ]) : RedirectResponse
Parameters
$request : Request
$path : string

A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))

$status : int = 302

The status code

Return values
RedirectResponse

createRequest()

Creates a Request.

public createRequest(Request $request, string $path) : Request
Parameters
$request : Request
$path : string

A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))

Return values
Request

generateUri()

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

public generateUri(Request $request, string $path) : string
Parameters
$request : Request
$path : string

A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))

Tags
throws
LogicException
Return values
string

        
On this page

Search results