switon/renderer

Template rendering with PHP and Sword engines, themes, and Frames composition for Switon Framework

Maintainers

Package info

github.com/switon-php/renderer

Documentation

pkg:composer/switon/renderer

Statistics

Installs: 21

Dependents: 3

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-07 04:43 UTC

This package is auto-updated.

Last update: 2026-06-07 04:50:20 UTC


README

CI PHP 8.3+

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 Frames before rendering.
  • Multiple engines: render .phtml and .sword templates through one RendererInterface.
  • 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.