# Response
Namespace Chevere\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',
user: 'rodo',
);
# 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) string
.
$string = $response->uuid();
# Token
The token
method is used to access to the Response token string
.
$tstring = $response->token();
# Data
The data
method is used to access to the Response data array
.
$array = $response->data();
# Code
The code
method is used to access to the Response code int
.
$integer = $response->code();