views:

519

answers:

10

Does anybody know any larger repositories of high-quality PHP classes and snippets? The only site I know is phpclasses.org, and while I mean no disrespect to its owner/s, its design looks pretty outdated (already has for a looong time) and the "social control" in terms of people reviewing and commenting on code is weak: There are lots and lots of bad code there.

Does anybody know anything in this direction, preferably with Stack Overflow-like interaction possibilities - voting, wiki-style editing, community functions.....?

Update: Starting a bounty to see what's new, out of curiosity. I will award the bounty to any really new, good, and modern suggestion that fulfills at least a part of my requirements above.

+7  A: 

I always look to the Zend Framework, and the Zend Extensions. They are usually very high quality.

Byron Whitlock
@Byron cheers, it's true, the ZF and associated libraries are very good stuff usually. Still, I am looking for an "independent" collection of well-written scripts and classes, some of which can have external dependencies but the collection as a whole should not be focused on one specific framework, no matter how good it is.
Pekka
+4  A: 

First of all, you might want to consider two different kind of repositories :

  • Those which host codes / plugins / modules for specific applications and/or Frameworks
  • And those which host either generalistic portions of code or generalistic libraries.


In the second category, the first idea that comes to mind would be pear.php.net -- but there is a lot of old code, many less-than-well documented libraries, lots of not-maintained stuff, ... Which pretty much means you'll have to go through a lot of stuff and eliminate the bad libraries yourself :-(

Two possible solutions might become interesting -- and they are quite recent :

I've never used those -- but it seems like some kind of repositories anyone can upload packages to ; and those packages can then be installed using the standard PEAR installer.

There doesn't seem to be any kind of voting / reputation / whatever system associated with those, though :-( But it might be interesting to suggest that as a possible improvement ;-)

So, not a real / great answer to your question, actually : there are components and stuff out there -- but the best way to know if something is great is to either test and/or review... And some stuff just lack documentation :-(


In the first category, things might be a bit easier : for lots of frameworks / applications, there are repositories of contributed modules or classes.

For instance, for Zend Framework, this could be interesting : ZF snippets (not that much life there either, though...) ; but note that official components of the framework are generally much more useful/better.
And that is probably true for many frameworks out there...

Another example would be Drupal and it's repository of modules -- and, there, you have some sorting by usage possibility, which is a bit of an indication of the quality (generally speaking) of those modules.

Pascal MARTIN
Pearhub is a great addition, but from what I've heard it is literally a few weeks old, so I doubt it has had time to really become rock solid.
Tchalvak
Pearhub and Pearfarm are indeed really not old -- I had never heard of them before the beginning of this year ;; I saved pearhub to my bookmarks on january 12th ; and judging from other people who bookmarked it on delicious, it's only a few days older : first bookmarks are from january 7th.
Pascal MARTIN
Cheers Pascal, it's a good overview on what's there. pearfarm and pearhub look very interesting but I f*ing hate PEAR. A catalogue-like collection for *anything* - "I need a OCR library for PHP, I need a function to find the dominant colour in an image, I need a library to convert hex-RGB-LAB colours", stuff like that, is what I am looking for, and there doesn't seem to be a "Stack Overflow of PHP snippets" around. I have that idea back in my mind to start something in this direction... Maybe later this year. Maybe I'll open a question to test the waters to that respect.
Pekka
@Pekka : I really like the PEAR distribution system mecanism *(it deals with versions, repositories, dependancies, ...)* ;;; but I have to admit I don't really like pear.php.net : to much bad code and old/unmaintained components, there... ;;; Let us know if you dig deeper into your idea ;-)
Pascal MARTIN
+12  A: 

Github.com, for living code in repositories. After I started using git, I see code just in zipped files for download on the web as dead code and stuff in repositories as live code (more potential). Mainly because live code will have a development history with it, and dead code won't.

In addition, github allows you to easily see how often (if at all) a snippet has been forked, which is usually a useful indicator of quality.

Tchalvak
A: 

I think your best bet is Google Code and Github repositories, or any project specific repositories. That's how usually find relevant PHP code. Even just browsing them can be fun, there's a lot of nice stuff but it's hard to find.

Nonetheless, lack of documentation is pretty common.

dlib
A: 

In addition to Zend Framework (mentioned by Byron), also look at EzComponents.

mehaase