Repository navigation
TextResponse
Viames Marino edited this page Apr 22, 2026
·
2 revisions
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.
new TextResponse(string $content, int $httpCode = 200, string $contentType = 'text/plain; charset=utf-8')
Arguments:
-
content: response body -
httpCode: HTTP status code -
contentType: response content type header
Example:
use Pair\Http\TextResponse;
return new TextResponse('challenge-token');-
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.
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4