How is Solar different from PEAR?

Regarding the latest release of Solar, Atrus asked: "How is this significantly different from PEAR?"

It's a good question. Let me outline some of what I think are the major differences. Please note that with maybe one exception, none of this is intended as criticism of PEAR, only as description. You can figure out for yourself where the criticism lies.

  1. As Atrus noted, Solar is built from the ground up for E_STRICT compliance in PHP5, which makes it incompatible with PHP4.
  2. Having said that, Solar is very much like PEAR in concept, in that one of its goals is to be a class library providing common web application functions: error handling, user authentication, querying SQL sources, OR mangement, and so on. However, Solar differs from PEAR in execution of that concept:
    • All class constructors have identical parameters (a single associative array).
    • Almost all Solar classes are extended from a single base class. The base class is relatively light and provides common functionality such as error generation and localization string handling. This means that all Solar classes have localization built in from the start. (Some classes are not extended from the base class; typically, these classes are collections of static methods.)
    • The classes are much more consistent with each other because they are the product of one coder (your humble servant).
    • The code is better-commented, easier to read, simpler, and more straightforward than most of what is found in PEAR.
  3. Solar is quite different from PEAR in that it is also a framework.
    • Yawp was my one attempt at building a straightforward and comprehensible foundation for rapid application development out of PEAR components. While Yawp is moderately successful at this, the inconsistency between PEAR classes makes it necessary to custom-code the "glue" between those classes so they can interoperate. With Solar, the classes are all so similar in implementation that it is much easier to make them interoperate.
    • As a framework, Solar has a consistent and extensible configuration mechanism that is identical for each class in the system; PEAR does not have such a mechanism.
    • Solar provides built-in methods for safe retrieval of user-provided variables and configuration values; PEAR does not.
  4. Solar provides mid-level independent application components out of the box (these are called Solar Cells). For example, there is a universal tagging mechanism, a combined comments/trackback storage system, a bug-tracking entity, and so on. Combining these components with a little procedural glue (e.g. in a controller action) gets you a lot of good functionality in a much less time. PEAR has no such unified component mechanism that I know of (happy to be proved wrong here).
  5. Solar comes with useful applications out-of-the-box (a bug tracker and a del.icio.us-like bookmark system) with more on the way, such as blog and wiki. With the one exception of phpDocumentor, PEAR does not. You might say that the "AR" in Solar is actually true. ;-) In this way, Solar might be more like Horde than PEAR.
  6. The communities are very different. PEAR is a mishmash of developers with their own goals and desires, driven by a voting system for new packages, herded like cats by an unelected Group that prefers to force collaboration under a rule of seniority, and with various (probably unfixable) flaws in the social norms; in other words, it is much like elitist democracy or mob rule under appointed oligarchy. Solar is more like beneficent dictatorship where the main rule is "be nice." ;-)
  7. Last but not least: PEAR has been in place for a few years now, and Solar is very young (first release was only 2 months ago). If you want to get in on the ground floor of a growing community of PHP5 developers and make a difference in a new project, this might be the place for you. Sign up for the mailing list at the Solar home page: http://solarphp.com.
Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving your codebase, all while keeping it running the whole time.