# Response
The Response component is in charge of providing a common response interface.
# Creating Response
Create a response by passing named data.
use Chevere\Response\Response;
$response = new Response(key: 'value');
# With data
The withData
method is used to set the Response data.
$response = $response
->withData(foo: $foo, bar: $bar);
# With code
The withCode
method is used to set Response code.
$response = $response->withCode(code: 0);
# Response codes
Code | Description |
---|---|
0 (default) | Success |
Non-zero value | Failure |
# UUID
The uuid
method is used to access to the Response UUID (opens new window) (V4).
$uuid = $response->uuid();
# Token
The token
method is used to access to the Response token.
$token = $response->token();
# Data
The data
method is used to access to the Response data.
$data = $response->data();
# Code
The code
method is used to access to the Response code.
$code = $response->code();