<p>I'm just curious if any project exists that attempts to group all (or most) of PHP's built-in functions into a more object-oriented class hierarchy. For example, grouping all the string functions into a single String class, etc.</p>

<p>I realize this won't actually solve any problems (unless the modifications took place at the PHP source code level), since all the built-in functions would still be accessible in the global namespace, but it would certainly make usability much easier.</p>

[{'answer_id': 61790, 'author': 'Kibbee', 'author_id': 1862, 'author_profile': 'https://Stackoverflow.com/users/1862', 'pm_score': 3, 'selected': False, 'text': "<p>I think something like this is intergral for PHP to move forward.  Being mainly a .Net programmer, I find PHP painful to work in with it's 1 million and 1 global functions.  It's nice that PHP 5.3 has namespaces, but it doesn't help things much when their own libraries aren't even object oriented, let alone employ namespaces.  I don't mind PHP as a language so much, but their API is terribly disorganized, and it probably needs a complete overhaul.  Kind of like what VB went through when it became VB.Net.</p>\n"}, {'answer_id': 61794, 'author': 'Allain Lalonde', 'author_id': 2443, 'author_profile': 'https://Stackoverflow.com/users/2443', 'pm_score': 3, 'selected': False, 'text': '<p>Way too many times.  As soon as someone discovers that PHP has OO features they want to wrap everything in classes. </p>\n\n<p>The point to the OO stuff in PHP is so that you can architect your solutions in whichever way you want.  But wrapping the existing functions in Objects doesn\'t yield much payoff.</p>\n\n<p>That being said PHP\'s core is quite object oriented already.  Take a look at <a href="http://www.php.net/~helly/php/ext/spl/" rel="nofollow noreferrer">SPL</a>.</p>\n'}, {'answer_id': 61825, 'author': 'SeanDowney', 'author_id': 5261, 'author_profile': 'https://Stackoverflow.com/users/5261', 'pm_score': 3, 'selected': True, 'text': '<p>To Answer your question, Yes there exists several of libraries that do exactly what you are talking about. As far as which one you want to use is an entirely different question. PHPClasses and pear.org are good places to start looking for such libraries.</p>\n\n<p>Update:\nAs the others have suggested SPL is a good library and wraps many of built in php functions. However there still are lots of php functions that it does not wrap. Leaving us still without a silver bullet.</p>\n\n<p>In using frameworks such as Cakephp and Zend (others too), I have noticed that they attempt to solve some of these problems by including their own libraries and building basics such as DB connectivity into the frame work. So frameworks may be another solution</p>\n'}, {'answer_id': 64574, 'author': 'user8134', 'author_id': 8134, 'author_profile': 'https://Stackoverflow.com/users/8134', 'pm_score': 2, 'selected': False, 'text': "<p>I don't agree. Object Oriented Programming is not inherently better than procedural programming. I believe that you should not use OO unless you need polymorphic behavior (inheritance, overriding methods, etc). Using objects as simple containers for code is not worth the overhead. This is <em>particularly</em> true of strings because their used so much (e.g. as array keys). Every application can usually benifit from some polymorphic features but usually at a high level. Would you ever want to extend a String class?</p>\n\n<p>Also, a little history is necessary to understand PHP's odd function naming. PHP is grounded around The Standard C Library and POSIX standard and uses many of the same function names (strstr, getcwd, ldap_open, etc). This is actually a good thing because it minimizes the amount of language binding code, ensures that a full well thought out set of features (just about anything you can do in C you can do in PHP) and these system libraries are highly optimized (e.g. strchr is usually inlined which makes it about 10x faster).</p>\n"}]
['https://Stackoverflow.com/questions/61784', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5291/']