switon/view

View composition and rendering support for Switon Framework

Maintainers

Package info

github.com/switon-php/view

Documentation

pkg:composer/switon/view

Statistics

Installs: 1

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-09 23:36 UTC

This package is auto-updated.

Last update: 2026-05-10 04:10:46 UTC


README

View composition and rendering support for Switon Framework.

Installation

composer require switon/view

Requirements: PHP 8.3+

Quick Start

use Switon\Core\Attribute\Autowired;
use Switon\Viewing\ViewInterface;

class UserController
{
    #[Autowired] protected ViewInterface $view;

    public function profileAction(): string
    {
        return $this->view
            ->setLayout('@view/Layouts/Default')
            ->setVars(['title' => 'Profile', 'user' => ['name' => 'Mark']])
            ->render('@view/User/Profile');
    }
}

Docs: https://docs.switon.dev/latest/view

License

MIT.