Example usage

In this examples we are using few aura components, but foa/responder-bundle is not specifically for Aura framework. You can integrate in any framework if you like the concept using its classes.

Consider you are having a blog application, which you can browse the posts. Let us see how it looks in ADR. You should pay special attention to responder only. Action and Service layer components may differ with what you are using.

Rendering and Setting content to response

Calling __invoke will render and set the content on the response object. Now you can either use Aura\Web\ResponseSender to send the response, or get the headers from response object and set to your favourite library response.

Integrated templating engines

Integrating other templating engines

<?phpnamespaceFOA\Responder_Bundle\Renderer;useFOA\Responder_Bundle\Renderer\RendererInterface;useYour\TemplateEngine;classYourTemplateEngineimplementsRendererInterface{publicfunction__construct(TemplateEngine$engine) {$this->engine=$engine; }publicfunctionrender($data, $view, $layout=null) {// according to how the rendering engine works. See other implementations// $this->engine->render }}