TextResponse - viames/pair GitHub Wiki
Pair framework: TextResponse
Pair\Http\TextResponse is the explicit plain-text response object for Pair v4.
Use it when an endpoint must return raw text instead of JSON or HTML, for example webhook challenge handshakes.
Constructor
new TextResponse(string $content, int $httpCode = 200, string $contentType = 'text/plain; charset=utf-8')
Arguments:
content: response bodyhttpCode: HTTP status codecontentType: response content type header
Example:
use Pair\Http\TextResponse;
return new TextResponse('challenge-token');
Notes
send()sets theContent-Typeheader and the HTTP status code, then prints the text body.- When
APP_DEBUG=trueand observability debug headers are enabled,send()also emits Pair correlation and trace timing headers. TextResponseimplementsPair\Http\ResponseInterface, so it works with the same runtime dispatch path asJsonResponseandPageResponse.
See also: API, ApiController, Controller, ResponseInterface, ApiErrorResponse, Observability, EmptyResponse.