Overview

Namespaces

  • Composer
    • Autoload
  • Illuminate
    • Support
      • Contracts
      • Facades
  • Laravella
    • Cart
      • Facades
  • None
  • PHP

Classes

  • App
  • Artisan
  • Auth
  • Blade
  • Cache
  • Config
  • Cookie
  • Crypt
  • DB
  • Event
  • Facade
  • File
  • Form
  • Hash
  • HTML
  • Input
  • Lang
  • Log
  • Mail
  • Paginator
  • Password
  • Queue
  • Redirect
  • Redis
  • Request
  • Response
  • Route
  • Schema
  • Session
  • URL
  • Validator
  • View
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php namespace Illuminate\Support\Facades;
 2: 
 3: use Illuminate\Http\JsonResponse;
 4: use Illuminate\Support\Contracts\ArrayableInterface;
 5: use Symfony\Component\HttpFoundation\BinaryFileResponse;
 6: 
 7: class Response {
 8: 
 9:     /**
10:      * Return a new response from the application.
11:      *
12:      * @param  string  $content
13:      * @param  int     $status
14:      * @param  array   $headers
15:      * @return \Symfony\Component\HttpFoundation\Response
16:      */
17:     public static function make($content = '', $status = 200, array $headers = array())
18:     {
19:         return new \Illuminate\Http\Response($content, $status, $headers);
20:     }
21: 
22:     /**
23:      * Return a new view response from the application.
24:      *
25:      * @param  string  $view
26:      * @param  array   $data
27:      * @param  int     $status
28:      * @param  array   $headers
29:      * @return \Symfony\Component\HttpFoundation\Response
30:      */
31:     public static function view($view, $data = array(), $status = 200, array $headers = array())
32:     {
33:         $app = Facade::getFacadeApplication();
34: 
35:         return static::make($app['view']->make($view, $data), $status, $headers);
36:     }
37: 
38:     /**
39:      * Return a new JSON response from the application.
40:      *
41:      * @param  string|array  $data
42:      * @param  int    $status
43:      * @param  array  $headers
44:      * @return \Illuminate\Http\JsonResponse
45:      */
46:     public static function json($data = array(), $status = 200, array $headers = array())
47:     {
48:         if ($data instanceof ArrayableInterface)
49:         {
50:             $data = $data->toArray();
51:         }
52: 
53:         return new JsonResponse($data, $status, $headers);
54:     }
55: 
56:     /**
57:      * Return a new streamed response from the application.
58:      *
59:      * @param  Closure  $callback
60:      * @param  int      $status
61:      * @param  array    $headers
62:      * @return \Symfony\Component\HttpFoundation\StreamedResponse
63:      */
64:     public static function stream($callback, $status = 200, array $headers = array())
65:     {
66:         return new \Symfony\Component\HttpFoundation\StreamedResponse($callback, $status, $headers);
67:     }
68: 
69:     /**
70:      * Create a new file download response.
71:      *
72:      * @param  SplFileInfo|string  $file
73:      * @param  string  $name
74:      * @param  array   $headers
75:      * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
76:      */
77:     public static function download($file, $name = null, array $headers = array())
78:     {
79:         $response = new BinaryFileResponse($file, 200, $headers, true, 'attachment');
80: 
81:         if ( ! is_null($name))
82:         {
83:             return $response->setContentDisposition('attachment', $name);
84:         }
85: 
86:         return $response;
87:     }
88: 
89: }
cart API documentation generated by ApiGen 2.8.0