Getting start with Volt in Phalcon is relatively straight-forward. With a simple switch to the Phalcon scaffold command the devtools can be made to output volt templates for the views instead of phtml templates. Both versions of the scaffolded code work in an identical fashion but the Volt version is easier to read and easier to modify.
Create the following table
create table user ( id int auto_increment, username varchar(30), firstname varchar(30), surname varchar(30), dateofbirth date, primary key(id) );
To scaffold the table while generating Volt for the views instead of phtml use the template-engine switch on the command line as follows:
phalcon scaffold user --get-set --template-engine=volt
... all views are created with a volt extension.
Looking at the code generated....
compared with the phtml equivalent code
It can be seen that the volt code is not only leaner but also more straightforward and easier to read. For programmers already very comfortable in php the difference might not be that great but those individuals should remember that code is written not just to be executed but also to be read, understood and maintained into the future.