class ResponseFactory implements ResponseFactory (View source)

Traits

Methods

static  void
macro( string $name, callable $macro)

Register a custom macro.

from Macroable
static  bool
hasMacro( string $name)

Checks if macro is registered.

from Macroable
static  mixed
__callStatic( string $method, array $parameters)

Dynamically handle calls to the class.

from Macroable
mixed
__call( string $method, array $parameters)

Dynamically handle calls to the class.

from Macroable
void
__construct( Factory $view, Redirector $redirector)

Create a new response factory instance.

make( string $content = '', int $status = 200, array $headers = array())

Return a new response from the application.

view( string $view, array $data = array(), int $status = 200, array $headers = array())

Return a new view response from the application.

json( string|array $data = array(), int $status = 200, array $headers = array(), int $options)

Return a new JSON response from the application.

jsonp( string $callback, string|array $data = array(), int $status = 200, array $headers = array(), int $options)

Return a new JSONP response from the application.

StreamedResponse
stream( Closure $callback, int $status = 200, array $headers = array())

Return a new streamed response from the application.

BinaryFileResponse
download( SplFileInfo|string $file, string $name = null, array $headers = array(), string|null $disposition = 'attachment')

Create a new file download response.

BinaryFileResponse
file( SplFileInfo|string $file, array $headers = array())

Return the raw contents of a binary file.

redirectTo( string $path, int $status = 302, array $headers = array(), bool|null $secure = null)

Create a new redirect response to the given path.

redirectToRoute( string $route, array $parameters = array(), int $status = 302, array $headers = array())

Create a new redirect response to a named route.

redirectToAction( string $action, array $parameters = array(), int $status = 302, array $headers = array())

Create a new redirect response to a controller action.

redirectGuest( string $path, int $status = 302, array $headers = array(), bool|null $secure = null)

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

redirectToIntended( string $default = '/', int $status = 302, array $headers = array(), bool|null $secure = null)

Create a new redirect response to the previously intended location.

Details

in Macroable at line line 24
static void macro( string $name, callable $macro)

Register a custom macro.

Parameters

string $name
callable $macro

Return Value

void

in Macroable at line line 35
static bool hasMacro( string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line line 49
static mixed __callStatic( string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line line 71
mixed __call( string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line line 41
void __construct( Factory $view, Redirector $redirector)

Create a new response factory instance.

Parameters

Factory $view
Redirector $redirector

Return Value

void

at line line 55
Response make( string $content = '', int $status = 200, array $headers = array())

Return a new response from the application.

Parameters

string $content
int $status
array $headers

Return Value

Response

at line line 69
Response view( string $view, array $data = array(), int $status = 200, array $headers = array())

Return a new view response from the application.

Parameters

string $view
array $data
int $status
array $headers

Return Value

Response

at line line 83
JsonResponse json( string|array $data = array(), int $status = 200, array $headers = array(), int $options)

Return a new JSON response from the application.

Parameters

string|array $data
int $status
array $headers
int $options

Return Value

JsonResponse

at line line 102
JsonResponse jsonp( string $callback, string|array $data = array(), int $status = 200, array $headers = array(), int $options)

Return a new JSONP response from the application.

Parameters

string $callback
string|array $data
int $status
array $headers
int $options

Return Value

JsonResponse

at line line 115
StreamedResponse stream( Closure $callback, int $status = 200, array $headers = array())

Return a new streamed response from the application.

Parameters

Closure $callback
int $status
array $headers

Return Value

StreamedResponse

at line line 129
BinaryFileResponse download( SplFileInfo|string $file, string $name = null, array $headers = array(), string|null $disposition = 'attachment')

Create a new file download response.

Parameters

SplFileInfo|string $file
string $name
array $headers
string|null $disposition

Return Value

BinaryFileResponse

at line line 147
BinaryFileResponse file( SplFileInfo|string $file, array $headers = array())

Return the raw contents of a binary file.

Parameters

SplFileInfo|string $file
array $headers

Return Value

BinaryFileResponse

at line line 161
RedirectResponse redirectTo( string $path, int $status = 302, array $headers = array(), bool|null $secure = null)

Create a new redirect response to the given path.

Parameters

string $path
int $status
array $headers
bool|null $secure

Return Value

RedirectResponse

at line line 175
RedirectResponse redirectToRoute( string $route, array $parameters = array(), int $status = 302, array $headers = array())

Create a new redirect response to a named route.

Parameters

string $route
array $parameters
int $status
array $headers

Return Value

RedirectResponse

at line line 189
RedirectResponse redirectToAction( string $action, array $parameters = array(), int $status = 302, array $headers = array())

Create a new redirect response to a controller action.

Parameters

string $action
array $parameters
int $status
array $headers

Return Value

RedirectResponse

at line line 203
RedirectResponse redirectGuest( string $path, int $status = 302, array $headers = array(), bool|null $secure = null)

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

Parameters

string $path
int $status
array $headers
bool|null $secure

Return Value

RedirectResponse

at line line 217
RedirectResponse redirectToIntended( string $default = '/', int $status = 302, array $headers = array(), bool|null $secure = null)

Create a new redirect response to the previously intended location.

Parameters

string $default
int $status
array $headers
bool|null $secure

Return Value

RedirectResponse