All Projects → yiisoft → view

yiisoft / view

Licence: BSD-3-Clause license
Yii view rendering library

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to view

nuts
Nuts and bolts for building cross-platform UI (HTML, Flutter, CLI) using Dart. Also screw frameworks (React, Vue, Angular).
Stars: ✭ 12 (-71.43%)
Mutual labels:  mvc, view
Wpemerge
A modern, MVC-powered WordPress as a CMS workflow. 🚀
Stars: ✭ 348 (+728.57%)
Mutual labels:  mvc, view
Toothyprogress
A polyline determinated ProgressBar written in Kotlin
Stars: ✭ 56 (+33.33%)
Mutual labels:  view, widgets
Codegen
A model-view based code generator written in Java
Stars: ✭ 36 (-14.29%)
Mutual labels:  mvc, view
Diamond
Diamond is a full-stack web-framework written in The D Programming Language using vibe.d
Stars: ✭ 173 (+311.9%)
Mutual labels:  mvc, view
Dry View
Complete, standalone view rendering system that gives you everything you need to write well-factored view code.
Stars: ✭ 124 (+195.24%)
Mutual labels:  mvc, view
Modelassistant
Elegant library to manage the interactions between view and model in Swift
Stars: ✭ 26 (-38.1%)
Mutual labels:  mvc, view
Flexml
🚀基于Litho的Android高性能动态业务容器。
Stars: ✭ 225 (+435.71%)
Mutual labels:  mvc, view
MVVM-Design-Pattern-Demo
An Xcode 9 project written in Swift 4 code designed using the MVVM design pattern, truly extolling the virtues of MVVM over MVC.
Stars: ✭ 31 (-26.19%)
Mutual labels:  mvc, view
Kuper
Free, feature-rich, easily customizable Android dashboard for widgets apps with Zooper widgets and/or Kustom assets (Widgets, Wallpapers and Komponents)
Stars: ✭ 114 (+171.43%)
Mutual labels:  widgets
cumulocity-app-builder
The Application Builder for Cumulocity provides a simple, coding-free way to create new applications inside Cumulocity. Application Builder is an open-source tool for you to create web applications in a no-code environment. Created by Global Presales.
Stars: ✭ 18 (-57.14%)
Mutual labels:  widgets
google streetview
A command line tool and module for Google Street View Image API
Stars: ✭ 77 (+83.33%)
Mutual labels:  view
pine-script-mode
GNU Emacs Major mode for Trading View pine script
Stars: ✭ 18 (-57.14%)
Mutual labels:  view
yii-bulma
Yii Framework Bulma Integration
Stars: ✭ 23 (-45.24%)
Mutual labels:  yii3
XRadarView
A highly customizable radar view for Android
Stars: ✭ 106 (+152.38%)
Mutual labels:  view
assets
Assets management
Stars: ✭ 17 (-59.52%)
Mutual labels:  yii3
Coroutines-Animations
Use the power of kotlin coroutines to execute your android animations
Stars: ✭ 31 (-26.19%)
Mutual labels:  view
wulaphp
一个有点复杂的PHP框架!
Stars: ✭ 26 (-38.1%)
Mutual labels:  mvc
Interactive-Add-Button-Layout
Custom Layout with interactive add button to impove your UI and UX .
Stars: ✭ 20 (-52.38%)
Mutual labels:  widgets
LPThumbnailView
A thumbnail view for iOS to give context to multiple images/videos using thumbnails and counter.
Stars: ✭ 54 (+28.57%)
Mutual labels:  view

Yii View Rendering Library


Latest Stable Version Total Downloads Build Status Code Coverage Scrutinizer Quality Score Mutation testing badge static analysis type-coverage

This library provides templates rendering abstraction supporting layout-view-subview hierarchy, custom renderers with PHP-based as default and more. It is used in Yii Framework but is supposed to be usable separately.

Requirements

  • PHP 7.4 or higher.

Installation

The package could be installed via composer:

composer require yiisoft/view --prefer-dist

General usage

The package provides two use cases for managing view templates:

State of View and WebView services

While being immutable and, by itself, stateless, both View and WebView services have sets of stateful and mutable data.

View service:

  • parameters,
  • blocks,
  • theme,
  • language.

WebView service:

  • parameters,
  • blocks,
  • theme,
  • language,
  • title,
  • meta and link tags,
  • JS/CSS strings,
  • JS/CSS files.

The state of View and WebView is not cloned when the services are cloned. So when using with*(), both new and old instances are sharing the same set of stateful mutable data. It allows, for example, to get WebView via type-hinting in a controller and change context path:

final class BlogController {
    private WebView $view;
    public function __construct (WebView $view) {
        $this->view = $view->withContextPath(__DIR__.'/views');
    }
}

... and then register CSS in a widget:

final class LastPosts extends Widget 
{    
    private WebView $view;
    public function __construct (WebView $view) {
        $this->view = $view;
    }
    protected function run(): string
    {
        ...
        $this->view->registerCss('.lastPosts { background: #f1f1f1; }');
        ...
    }
}

To get a deep cloned View or WebView use withClearedState():

$view = $view->withClearedState();

Extensions

  • yiisoft/yii-view - a wrapper that is used in Yii Framework. Adds additional functionality for a WEB environment and compatibility with PSR-7 interfaces.
  • yiisoft/view-twig - an extension that provides a view renderer that will allow you to use the Twig view template engine, instead of the default PHP renderer.

Testing

Unit testing

The package is tested with PHPUnit. To run tests:

./vendor/bin/phpunit

Mutation testing

The package tests are checked with Infection mutation framework with Infection Static Analysis Plugin. To run it:

./vendor/bin/roave-infection-static-analysis-plugin

Static analysis

The code is statically analyzed with Psalm. To run static analysis:

./vendor/bin/psalm

License

The Yii View Rendering Library is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

Open Collective

Follow updates

Official website Twitter Telegram Facebook Slack

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].