Download the PHP package goetas/twital without Composer
On this page you can find all versions of the php package goetas/twital. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download goetas/twital
More information about goetas/twital
Files in goetas/twital
Package twital
Short Description PHP templating engine that combines Twig and PHPTal power points
License MIT
Homepage https://github.com/goetas/twital
Informations about the package twital
What is Twital?
Twital is a template engine built on top of Twig (a template engine for PHP and default template engine on Symfony) that adds some shortcuts and makes Twig's syntax more suitable for HTML based (XML, HTML5, XHTML, SGML) templates. Twital takes inspiration from PHPTal, TAL and AngularJS or Vue.js (just for some aspects), mixing their language syntaxes with the powerful Twig templating engine system.
Twital is fully compatible with Twig, all Twig templates can be rendered using Twital.
To better understand the Twital's benefits, consider the following Twital template, which simply shows a list of users from an array:
To do the same thing using Twig, you need:
As you can see, the Twital template is more readable, less verbose and and you don't have to worry about opening and closing block instructions (they are inherited from the HTML structure).
One of the main advantages of Twital is the implicit presence of control statements, which makes templates more readable and less verbose. Furthermore, it has all Twig functionalities, such as template inheritance, translations, looping, filtering, escaping, etc.
If some Twig functionality is not directly available for Twital, you can freely mix Twig and Twital syntaxes.
In the example below, we have mixed Twital and Twig syntaxes to use Twig custom tags:
When needed, you can extend from a Twig template:
You can also extend from Twig a Twital template:
A presentation of Twital features and advantages is available on this presentation.
Installation
The recommended ways install Twital is via Composer.
Documentation
Go here http://twital.readthedocs.org/ to read a more detailed documentation about Twital.
Getting started
First, you have to create a file that contains your template
(named for example demo.twital.html
):
Afterwards, you have to create a PHP script that instantiate the required objects:
That's it!
Symfony Users
If you are a Symfony user, you can add Twital to your project using the TwitalBundle.
The bundle integrates all most common functionalities as Assetic, Forms, Translations, Routing, etc.
Twig Users
Starting from version Twital 1.0.0, both twig 1.x and 2.x versions are supported.
Note
The code in this project is provided under the MIT license. For professional support contact [email protected] or visit https://www.goetas.com
All versions of twital with dependencies
ext-dom Version *
masterminds/html5 Version ^2.1.2
twig/twig Version ^1.43|^2.13|^3.0
symfony/event-dispatcher Version ^3.4|^4.4|^5.1|^6.0