EDIT: Geez, I could have really gone with a better title for this topic.
Hi all,
One of my biggest gripes with PHP compared to just about every other language out there, is it’s incredibly inconsistent, ugly and non-object-orientated API. As an example, the available PHP string functions such as strstr(), str_pos(), str_replace(), and so on, are inconsistent not only in how they’re named, but also in argument order and sometimes behaviour. Then you have PHP libraries such as curl, fopen and anything else that uses “resources”, which are simply begging to be implemented as classes.
I’m thinking of developing an open-source PHP library, written in PHP, which wraps many of the legacy-style PHP functions into simple, elegant and powerful objects. This library, in addition to wrapping legacy procedural functions into a logical set of objects, could also make use of namespaces; something which no built-in PHP library or extension currently makes use of.
Let’s face it, as much as PHP’s API’s need a complete overhaul in order to keep up with the rapidly changing language, it’s not going to happen any time soon. In the mean time, I’m wondering if developers would be willing to sacrifice a relatively small bit of performance by using such as wrapper library to speed up development times, potentially reduce bugs, and most importantly, make PHP a nicer language to work in.
So I’ve started this topic simply to get a general opinion from those who spend a lot of time programming with PHP, and more specifically, PHP 5.2 and 5.3? Additionally, do you think it would be worth focusing on PHP 5.3 compatibility only, in order to make use of namespaces and other modern PHP features, and to act as a further incentive for people and ultimately hosting companies to move to PHP 5.3?
By the way, if I were to commit to such a project, rest assured that I’m a bit of a perfectionist, so would likely spend most my time planning and designing the API to make it as nice as possible; think jQuery-esque.