A simple function that will send PSR-7 ResponseInterface headers and body.
composer require http-interop/response-senderuse function Http\Response\send;
// Any ResponseInterface instance can be used.
$notFound = $responseFactory->createResponse(404);
// Send headers and body.
send($notFound);MIT