Описание тега volt
Phalcon is an open source, full stack framework for PHP 5 written as a C extension, optimized for high performance. Developers don't need to learn or use the C language, since the functionality is exposed as PHP classes ready to be used. For more information about Phalcon, you can either check the Phalcon website or the Phalcon tag.
One of the main features of Phalcon is Volt, an ultra fast template engine written solely in C.
Volt is enhancing the view layer of Phalcon with a simple and user friendly syntax. It is inspired by Twig, originally created by Armin Ronacher. which in turn is inspired in Jinja. It therefore exposes a familiar syntax to many developers, especially those that have been using Twig. Volt’s syntax and features have been enhanced with more elements and of course with the performance that developers have been accustomed to while working with Phalcon.
Volt views are compiled to pure PHP code, hence they save the effort of writing PHP code manually. As an added value, Volt is integrated with \Phalcon\Tag
, making the creation of views in Phalcon applications much easier than before. For instance creating a text box is as easy as:
<label>Name</label>
{{ text_field("mytext", "size": 32) }}
which in turn when compiled becomes:
<label>Name</label>
<?php echo Phalcon\Tag::textField(array('mytext', 'size' => 32)); ?>
A core design feature in Volt is security, so it offers a limited set of functions that can be used in the templates, while aiding in escaping potentially malicious input by the users.
The first iteration of the Volt templating engine is introduced in 0.6.0, which covers a basic functional basis. As time passes by, more and more features will be added.
You can find Phalcon and Volt in the Github page of the project.