Template rendering with shared Frames, .phtml and .sword templates, and theme-aware lookup for Switon Framework.
- Shared frames: compose layout and partial data with
Framesbefore rendering. - Multiple engines: render
.phtmland.swordtemplates through oneRendererInterface. - Theme-aware lookup: resolve views with theme and alias boundaries.
composer require switon/rendereruse Switon\Core\Attribute\Autowired;
use Switon\Rendering\Frames;
use Switon\Rendering\RendererInterface;
class WelcomePage
{
#[Autowired] protected RendererInterface $renderer;
public function render(array $user): string
{
$frames = Frames::of(['title' => 'Welcome', 'user' => $user]);
return $this->renderer->render('@app/View/home', [], $frames)->content();
}
}Docs: https://docs.switon.dev/latest/renderer
MIT.