PHPackages                             kenny1911/twig-view - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. kenny1911/twig-view

ActiveLibrary[Testing &amp; Quality](/categories/testing)

kenny1911/twig-view
===================

Type-safe Twig views with template validation and testing capabilities

0.2.1(3mo ago)0241—5%MITPHPPHP ^8.1

Since Nov 11Pushed 3mo agoCompare

[ Source](https://github.com/Kenny1911/twig-view)[ Packagist](https://packagist.org/packages/kenny1911/twig-view)[ RSS](/packages/kenny1911-twig-view/feed)WikiDiscussions 0.2 Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (6)Used By (0)

Twig View
=========

[](#twig-view)

\[English\]\[[Русский](./README-RU.md)\]

A package for typing Twig templates and verifying their correctness during testing.

The Problem
-----------

[](#the-problem)

When using Twig templates, errors are often discovered only at runtime because static analyzers cannot effectively verify the correctness of data passed to templates. Common issues include:

- Passing non-existent variables to templates
- Lack of null checks
- Data type mismatches

The Solution
------------

[](#the-solution)

This package provides a system of typed views that explicitly define data structures for templates, along with tools for testing these views.

Installation
------------

[](#installation)

```
composer require kenny1911/twig-view
```

Usage
-----

[](#usage)

### Describe view class, using `View` attribute

[](#describe-view-class-using-view-attribute)

```
