Response

class Response (View source)

Traits

MacroableTrait

Properties

static protected array $macros The registered string macros. from MacroableTrait

Methods

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

Register a custom macro.

from MacroableTrait
static boolean hasMacro(string $name)

Checks if macro is registered

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

Dynamically handle calls to the class.

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

Dynamically handle calls to the class.

from MacroableTrait
static Response make(string $content = '', int $status = 200, array $headers = array())

Return a new response from the application.

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

Return a new view response from the application.

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

Return a new JSON response from the application.

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

Return a new JSONP response from the application.

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

Return a new streamed response from the application.

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

Create a new file download response.

Details

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

Register a custom macro.

Parameters

string $name
callable $macro

Return Value

void

static boolean hasMacro(string $name)

Checks if macro is registered

Parameters

string $name

Return Value

boolean

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

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

static 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

static 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

static 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

static JsonResponse jsonp(string $callback, string|array $data = [], int $status = 200, array $headers = [], 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

static 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

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

Create a new file download response.

Parameters

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

Return Value

BinaryFileResponse

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Support/Facades/Response.html