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

Zephir: An outsider's perspective

First, let me say that I think Phalcon is very unique amongst the PHP framework offerings, which considering the sheer number of PHP frameworks is saying a lot, and I am not currently using Phalcon. I wouldn't post this if I didn't WANT to use Phalcon or if I felt the project wasn't extremely worthwhile. I am posting this to throw in a voice that I suspect is indicative of a much larger prospective developer base so that hopefully the next time around I can use Phalcon.

Background: I have about 25 years of programming experience dating back to the days of BASIC and Pascal. Many of those years were spent in C and a smaller set of those years were spent in C++. I made the switch to PHP for web development at the introduction of PHP4. My major issue with PHP is with its "loose" typing, which is where I see many security vulnerabilities have hidden over the years (as well as no requisite that variables be initialized).

Case Study: I am presently involved with building a large PHP-based web application. I am part of a team of about half a dozen developers with varying levels of experience. As part of the initial evaluations, we took a survey of the PHP framework landscape. The overwhelming theme seems to be that PHP frameworks have matured considerably and most of the "decent" frameworks share a similiar feature set. In evaluating our top choice, I was struck with the speed (or lack thereof) issue. Phalcon was considered for this project originally and I circled back after re-considering the value of the Phalcon approach and re-assessing its weaknesses.

The pro-competitor argument is that PHP developers can easily modify any PHP-based framework, if it ever became absolutely necessary, whereas modifying Phalcon would require C-programming experience. There is some merit to that argument, but I have C programming experience, so that's not a deal breaker. What was, and is, a deal breaker is that Phalcon is no longer using C. Nor is it using C++. It has jumped into adopting its OWN language (Zephir). I am guessing that this is intended to be more attractive to PHP developers. However, this approach raises several major concerns: 1.) the future of the Phalcon framework is no longer based solely on the success of the framework, but also the success of this new fledgling language, 2.) while there may be a small set of C programmers, there is an even smaller set of Zephir programmers, 3.) Zephir, at a glance, appears to be introducing the same kind of looseness that is so endemic to PHP's issues (i.e. one of the very reasons I would consider Phalcon if it were based entirely on the strictness of C).

So, with due respect to the amazing Phalcon and Zephir developers, I would humbly request that Phalcon return to its C roots. I submit that Zephir doesn't solve the real problem (programming is hard) and that it turns off more developers than it attracts. If C lacks sufficient flexibiity to accomplish the long-term goals of Phalcon, then adopt C++. Both are proven languages with immense resources available (IDEs, debuggers, code analyzers, etc., etc.,) that Zephir will NEVER be able to match (not even to a small degree). With its current approach of introducing an unproven intermediary language, a reasonable business case cannot be made for Phalcon. Thank you everyone for opening my eyes to a better approach to PHP frameworks.

Welcome to the Phalcon community :)

The main reason we chose Zephir was to introduce more functionality in the framework from contributions initiated by the community. Let's face it. C is a daunting language and if you don't have the experience, you won't start now. It is just the way things are.

Throughout all the versions we have developed the past two years, our contributors have been just a handful, yet we are asked for more NFRs every day. The community and user base has grown exponentially the last few versions and we want to be able to offer more. However our small team cannot handle all the NFRs that are coming in, primarlily because this is not our main job. We are not Zend which sponsors Zend Framework or Sensio that sponsors Symfony.

Therefore Zephir was born. An intermediate step between PHP and C. By introducing this language we managed to get more people involved, offering contributions/pull requests in a much greater rate than before.

The key though is that Phalcon 2.0 is written in Zephir but Zephir produces the C code necessary to compile the extension. Nothing stops a developer (such as yourself) who is fluent in C, to modify the output of Zephir (which is C code) according to one's needs.

To me it doesn't matter that Zephir is unproven. If it generates the proper C code (as we have now with pure C programming) it has done its job.

Just my 2 cents.

Thank you for taking the time to put together a thoughtful reply. Much appreciated!