Documentation

ResponseFactory

Table of Contents

download()  : BinaryFileResponse
Create a new file download response.
json()  : JsonResponse
Return a new JSON response from the application.
jsonp()  : JsonResponse
Return a new JSONP response from the application.
make()  : Response
Return a new response from the application.
redirectGuest()  : RedirectResponse
Create a new redirect response, while putting the current URL in the session.
redirectTo()  : RedirectResponse
Create a new redirect response to the given path.
redirectToAction()  : RedirectResponse
Create a new redirect response to a controller action.
redirectToIntended()  : RedirectResponse
Create a new redirect response to the previously intended location.
redirectToRoute()  : RedirectResponse
Create a new redirect response to a named route.
stream()  : StreamedResponse
Return a new streamed response from the application.
view()  : Response
Return a new view response from the application.

Methods

download()

Create a new file download response.

public download(SplFileInfo|string $file[, string $name = null ][, array<string|int, mixed> $headers = [] ][, string|null $disposition = 'attachment' ]) : BinaryFileResponse
Parameters
$file : SplFileInfo|string
$name : string = null
$headers : array<string|int, mixed> = []
$disposition : string|null = 'attachment'
Return values
BinaryFileResponse

json()

Return a new JSON response from the application.

public json([string|array<string|int, mixed> $data = [] ][, int $status = 200 ][, array<string|int, mixed> $headers = [] ], int $options) : JsonResponse
Parameters
$data : string|array<string|int, mixed> = []
$status : int = 200
$headers : array<string|int, mixed> = []
$options : int
Return values
JsonResponse

jsonp()

Return a new JSONP response from the application.

public jsonp(string $callback[, string|array<string|int, mixed> $data = [] ][, int $status = 200 ][, array<string|int, mixed> $headers = [] ], int $options) : JsonResponse
Parameters
$callback : string
$data : string|array<string|int, mixed> = []
$status : int = 200
$headers : array<string|int, mixed> = []
$options : int
Return values
JsonResponse

make()

Return a new response from the application.

public make([string $content = '' ][, int $status = 200 ][, array<string|int, mixed> $headers = [] ]) : Response
Parameters
$content : string = ''
$status : int = 200
$headers : array<string|int, mixed> = []
Return values
Response

redirectGuest()

Create a new redirect response, while putting the current URL in the session.

public redirectGuest(string $path[, int $status = 302 ][, array<string|int, mixed> $headers = [] ][, bool|null $secure = null ]) : RedirectResponse
Parameters
$path : string
$status : int = 302
$headers : array<string|int, mixed> = []
$secure : bool|null = null
Return values
RedirectResponse

redirectTo()

Create a new redirect response to the given path.

public redirectTo(string $path[, int $status = 302 ][, array<string|int, mixed> $headers = [] ][, bool|null $secure = null ]) : RedirectResponse
Parameters
$path : string
$status : int = 302
$headers : array<string|int, mixed> = []
$secure : bool|null = null
Return values
RedirectResponse

redirectToAction()

Create a new redirect response to a controller action.

public redirectToAction(string $action[, array<string|int, mixed> $parameters = [] ][, int $status = 302 ][, array<string|int, mixed> $headers = [] ]) : RedirectResponse
Parameters
$action : string
$parameters : array<string|int, mixed> = []
$status : int = 302
$headers : array<string|int, mixed> = []
Return values
RedirectResponse

redirectToIntended()

Create a new redirect response to the previously intended location.

public redirectToIntended([string $default = '/' ][, int $status = 302 ][, array<string|int, mixed> $headers = [] ][, bool|null $secure = null ]) : RedirectResponse
Parameters
$default : string = '/'
$status : int = 302
$headers : array<string|int, mixed> = []
$secure : bool|null = null
Return values
RedirectResponse

redirectToRoute()

Create a new redirect response to a named route.

public redirectToRoute(string $route[, array<string|int, mixed> $parameters = [] ][, int $status = 302 ][, array<string|int, mixed> $headers = [] ]) : RedirectResponse
Parameters
$route : string
$parameters : array<string|int, mixed> = []
$status : int = 302
$headers : array<string|int, mixed> = []
Return values
RedirectResponse

stream()

Return a new streamed response from the application.

public stream(Closure $callback[, int $status = 200 ][, array<string|int, mixed> $headers = [] ]) : StreamedResponse
Parameters
$callback : Closure
$status : int = 200
$headers : array<string|int, mixed> = []
Return values
StreamedResponse

view()

Return a new view response from the application.

public view(string $view[, array<string|int, mixed> $data = [] ][, int $status = 200 ][, array<string|int, mixed> $headers = [] ]) : Response
Parameters
$view : string
$data : array<string|int, mixed> = []
$status : int = 200
$headers : array<string|int, mixed> = []
Return values
Response

Search results