> For the complete documentation index, see [llms.txt](https://sw-fw-less.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sw-fw-less.gitbook.io/project/mvc/response.md).

# Response

### Example

```
// Response plain text with status code 200
\App\components\Response::output('ok');

// Response plain text with status code 500
\App\components\Response::output('fail', 500);

// Response json with status code 200
\App\components\Response::json(['foo' => 'bar']);
\App\components\Response::json('{"foo": "bar"}');

// Response json with status code 500
\App\components\Response::json(['foo' => 'bar'], 500);
\App\components\Response::json('{"foo": "bar"}', 500);

// Response plain text with status code 200 and headers
\App\components\Response::output('ok', 200, ['X-UUID' => 123456]);

// Response json with status code 200 and headers
\App\components\Response::json(['foo' => 'bar'], 200, ['X-UUID' => 123456]);
\App\components\Response::json('{"foo": "bar"}', 200, ['X-UUID' => 123456]);
```
