PHP Tag Libraries

March 30th, 2007 by mike

I’ve never quite understood why no one writes PHP libraries in C. The platform completely supports it. In JSP, when you need a tag that doesn’t exist and none of the 10,000,000 Java classes that you’ve installed with your latest and most buzzword-compliant framework supply it, you write it — in Java. You compile it and install it on the machine. At this point, new functionality exists for all of your JSP pages and you can write-in that cute little tag that you created that converts strings to lowercase.

For some reason, this concept seems to evade the PHP world. Zend just relased one of their (most likely) last betas of their Zend Framework. This is, of course, written in PHP. But why? Why is it not written as a (set of) PHP module(s)? It’s not that hard to write a little bit of C. It would improve the performance and memory consumption by many times. It would be just as functional as a pure PHP library.

Now I know, you think, “Oh god, I can’t <gasp> manage my own memory!” The concept of not managing your own memory is like driving a car without ever looking at the fuel gauge. You just drive the car along, and some ‘magic’ component of it monitors the fuel level and pulls you in to a filling station to re-fuel without you ever being the wiser. I think this is foolish. Pull out those CS-101 books. Dust them off, open them, and bask in the credit you will receive for doing something that has, for some reason, become something of a black-art.

I guess there are those who will also say that shared hosting companies don’t allow you to install PHP modules. This is true, and those people can use something like Cake. The vast majority of the <shiver> “Enterprise-level” PHP installations are being hosted either in-house or at a facility which would gladly allow you to install a custom PHP module.

So, what’s the holdup? I am, after all, talking about the same company that writes the PHP engine — in C. What are we waiting for?

The bottom line is: If you can write an apache module in C to interpret PHP, then you can write a library in it. It would be faster, smaller, and more elegant — but nobody cares about speed, size, or elegance anymore, just time-to-market and immediate ROI. But what do I know?

Posted in Rant, Thoughts |

Leave a Reply