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]);

Last updated