We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt Standalone

Is there a .so and .dll for using volt as standalone extension ? Like without phalcon for using with other frameworks or no framework ? It could be really great. I guess i can just add phalcon and use volt classes anywhere ?



199

That would be the best option. There is no problem in using only selected classes from whole Phalcon package.

Also I don't think that creating separate .so/.dll with just some functionality makes sense.



5.7k
edited Jul '15

Similar to VOLT

TWIG is very similar to VOLT in many ways and I use it (TWIG) every day. However, twig is an actual templating engine (which can also be used with Phalcon) but VOLT is just a template compiler that creates .php files.

VOLT files are not actually executed on page load, just compiled to php files then the compiled file is run on each request.

The system I built that uses the TWIG templating engine runs 925 websites (as of this morning) and it does it very well. Since TWIG does not just compile to raw PHP, it has a lot of internal overhead, even when using extensive caching, compared to the output by VOLT. At work, I've used xdebug profiling to profile hundreds of sites and TWIG does have a lot more overhead than the php files generated by VOLT.

In regards to the OP by @Jurigag, if you just include the phalcon.so file, you can use VOLT as a standalone component : https://docs.phalcon.io/en/latest/reference/volt.html#stand-alone-component

The overhead of including the whole phalcon framework is not going to impact your performance.

Yea, thats why i am asking :P Cuz twig has overhead even when caching etc. Cuz generate each class for each view, and when one view has many includes, blocks etc and extends many other views its using many classes and slowing app down. Volt just generate one final php for each view, even when many includes etc so i just wanted to use volt :P Someday i gonna check volt with symfony, twig and volt have almost similar syntax so i hope no problem with migration from twig to volt.