switon / renderer
Template rendering with PHP and Sword engines, themes, and Frames composition for Switon Framework
v1.0.0
2026-06-07 04:43 UTC
Requires
- php: >=8.3
- psr/event-dispatcher: ^1.0
- switon/core: ^1.0
- switon/event: ^1.0
- switon/sync: ^1.0
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- switon/testing: ^1.0
README
Template rendering with shared Frames, .phtml and .sword templates, and theme-aware lookup for Switon Framework.
Highlights
- 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.
Installation
composer require switon/renderer
Quick Start
use 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
License
MIT.