responsePassthrough.php
Table of Contents
Functions
- responsePassthrough() : callable
- Returns a passthrough handler that simply returns the response unchanged.
Functions
responsePassthrough()
Returns a passthrough handler that simply returns the response unchanged.
responsePassthrough() : callable
This is useful for routes that don't need to perform any processing, such as OPTIONS requests that only need to return CORS headers or other middleware-handled responses.
Usage Examples
use function oihana\routes\helpers\responsePassthrough;
// Simple OPTIONS route
$app->options('/api/users', responsePassthrough(...));
// HEAD route that mirrors GET
$app->head('/api/users', responsePassthrough(...));
// Any route where middleware handles everything
$app->get('/health', responsePassthrough(...));
Tags
Return values
callable —A PSR-15 compatible request handler that returns the response as-is.