A second look at Zephir

Ever since I found out about Zephir, I have been very curious about it. I mean compiled PHP code. How awesome is that? Also, Zephir code doesn’t have to be compiled into a PHP extension. You can just convert it to binary and run it normally like any other PHP code.

Why spend a lot on Zend Guard or any other encoding software when you can do it for free with Zephir? There is a caveat though: Zephir is not PHP. It has similarities but it is not completely PHP code. So, you would have to learn whqt works and what doesn’t.

One thing to note is that it is still in beta. Phalcon has been out for a while so I figured it would at least be 1.0.0 stable. However, that is not the case. At the time of writing this article, the latest version is 0.9.8b. I have always wanted to write code as PHP extension so it would run much faster than regular PHP code.

I read (haven’t benchmarked yet) that not all compiled Zephir code runs faster than regular PHP code. This is probably because of some I/O bottlenecks. If you are planning on using Zephir, make sure you benchmark the performance for your use case. If compiling doesn’t make things any faster then its not worth the extra pain to compile and install a PHP extension.

By Moazzam

Moazzam is a software developer working in the big apple. He has over a decade of experience in development. While most of his work involves developing web applications, he does development for Android and Windows Mobile in his spare time.

Leave a Reply

Your email address will not be published. Required fields are marked *