Skip to content

Repository files navigation

Switon Renderer Package

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.

About

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

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages