Redirect
Redirect
HTTP 302 Redirect response class.
class Redirect extends \Hazaar\Controller\Response\HTTP\ResponseThis response indicates that the requested resource resides temporarily under a different URI. The client should use the URL provided in the Location header to access the resource.
Properties
url
The URL to which the client is redirected.
private URL $urlparams
Parameters to be included in the redirect response.
private array $paramsMethods
__construct
Constructs the HTTP 302 Redirect response.
public __construct(URL $url): voidThis constructor initializes the response with a status code of 302 and sets the redirect URL. If the provided URL is a string, it is converted to a URL object.
Parameters
| Parameter | Type | Description |
|---|---|---|
$url | URL | The URL to redirect to. Can be a string or a URL object. |
with
Sets the parameters for the redirect response.
public with(array $params): selfParameters
| Parameter | Type | Description |
|---|---|---|
$params | array |
getContent
Generates the response content for the redirect.
public getContent(): stringBuilds a query string from the parameters, sets the 'Location' header with the constructed URL and query string, and returns an empty string as the response body.
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000