All of your WordPress and Router controllers should return PSR7 compliant response. The most common use-case is rendering a twig view and passing in some context. Using Timber it would look like this:
As we make use of a great 3rd party package: Zend Diactoros, Lumberjack includes an array of handy responses out-of-the-box.
$response =newRareloop\Lumberjack\Http\Responses\TimberResponse('home', $context);// Check out their documentation for further details and examples:// https://zendframework.github.io/zend-diactoros/$response =newZend\Diactoros\Response\TextResponse('Hello world!');$response =newZend\Diactoros\Response\HtmlResponse($htmlContent);$response =newZend\Diactoros\Response\XmlResponse($xml);$response =newZend\Diactoros\Response\JsonResponse($data);$response =newZend\Diactoros\Response\EmptyResponse(); // Basic 204 response:$response =newZend\Diactoros\Response\RedirectResponse('/user/login');