blob: 2cd928dc741e356fa134c8ef6872d8c782b17ea5 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Illuminate\Contracts\Routing;
4
5interface ResponseFactory
6{
7 /**
8 * Create a new response instance.
9 *
10 * @param string $content
11 * @param int $status
12 * @param array $headers
13 * @return \Illuminate\Http\Response
14 */
15 public function make($content = '', $status = 200, array $headers = []);
16
17 /**
18 * Create a new "no content" response.
19 *
20 * @param int $status
21 * @param array $headers
22 * @return \Illuminate\Http\Response
23 */
24 public function noContent($status = 204, array $headers = []);
25
26 /**
27 * Create a new response for a given view.
28 *
29 * @param string|array $view
30 * @param array $data
31 * @param int $status
32 * @param array $headers
33 * @return \Illuminate\Http\Response
34 */
35 public function view($view, $data = [], $status = 200, array $headers = []);
36
37 /**
38 * Create a new JSON response instance.
39 *
40 * @param mixed $data
41 * @param int $status
42 * @param array $headers
43 * @param int $options
44 * @return \Illuminate\Http\JsonResponse
45 */
46 public function json($data = [], $status = 200, array $headers = [], $options = 0);
47
48 /**
49 * Create a new JSONP response instance.
50 *
51 * @param string $callback
52 * @param mixed $data
53 * @param int $status
54 * @param array $headers
55 * @param int $options
56 * @return \Illuminate\Http\JsonResponse
57 */
58 public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0);
59
60 /**
61 * Create a new streamed response instance.
62 *
63 * @param \Closure $callback
64 * @param int $status
65 * @param array $headers
66 * @return \Symfony\Component\HttpFoundation\StreamedResponse
67 */
68 public function stream($callback, $status = 200, array $headers = []);
69
70 /**
71 * Create a new streamed response instance as a file download.
72 *
73 * @param \Closure $callback
74 * @param string|null $name
75 * @param array $headers
76 * @param string|null $disposition
77 * @return \Symfony\Component\HttpFoundation\StreamedResponse
78 */
79 public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment');
80
81 /**
82 * Create a new file download response.
83 *
84 * @param \SplFileInfo|string $file
85 * @param string|null $name
86 * @param array $headers
87 * @param string|null $disposition
88 * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
89 */
90 public function download($file, $name = null, array $headers = [], $disposition = 'attachment');
91
92 /**
93 * Return the raw contents of a binary file.
94 *
95 * @param \SplFileInfo|string $file
96 * @param array $headers
97 * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
98 */
99 public function file($file, array $headers = []);
100
101 /**
102 * Create a new redirect response to the given path.
103 *
104 * @param string $path
105 * @param int $status
106 * @param array $headers
107 * @param bool|null $secure
108 * @return \Illuminate\Http\RedirectResponse
109 */
110 public function redirectTo($path, $status = 302, $headers = [], $secure = null);
111
112 /**
113 * Create a new redirect response to a named route.
114 *
115 * @param string $route
116 * @param mixed $parameters
117 * @param int $status
118 * @param array $headers
119 * @return \Illuminate\Http\RedirectResponse
120 */
121 public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []);
122
123 /**
124 * Create a new redirect response to a controller action.
125 *
126 * @param string $action
127 * @param mixed $parameters
128 * @param int $status
129 * @param array $headers
130 * @return \Illuminate\Http\RedirectResponse
131 */
132 public function redirectToAction($action, $parameters = [], $status = 302, $headers = []);
133
134 /**
135 * Create a new redirect response, while putting the current URL in the session.
136 *
137 * @param string $path
138 * @param int $status
139 * @param array $headers
140 * @param bool|null $secure
141 * @return \Illuminate\Http\RedirectResponse
142 */
143 public function redirectGuest($path, $status = 302, $headers = [], $secure = null);
144
145 /**
146 * Create a new redirect response to the previously intended location.
147 *
148 * @param string $default
149 * @param int $status
150 * @param array $headers
151 * @param bool|null $secure
152 * @return \Illuminate\Http\RedirectResponse
153 */
154 public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null);
155}