The PEAR book

October 15th, 2006. Tagged: News/personal, PEAR

PEAR bookIn case you've missed it - the PEAR book hit the streets! The exact title is "PHP Programming with PEAR" and it's co-written by Stephan Schmidt, Carsten Lucke, Aaron Wormus and yours truly. Aaron also put up a Wiki for book and PEAR-related updates, it's at

I tried to put up a list of the packages and classes covered in the book, I've probably missed some classes, especially Date_* and Calendar_* ones, but I hope I got all the packages. Here goes (alphabetically) :

  • Calendar
  • Date
  • Date_Holidays
  • Date_Span
  • Date_Timezone
  • File_PDF
  • HTML_Table
  • HTML_Table_Matrix
  • HTTP_Request
  • MDB2
  • MDB2_Schema
  • Services_AmazonESC4
  • Services_Ebay
  • Services_Google
  • Services_Technorati
  • Services_Webservice
  • Services_Yahoo_Search
  • Spreadsheet_Excel_Writer
  • Structures_DataGrid
  • Structures_DataGrid_Column
  • Structures_DataGrid_DataSource
  • XML_Beautifier (mention)
  • XML_FastCreate
  • XML_Parser
  • XML_RPC_Client
  • XML_RPC_Message
  • XML_RPC_Response
  • XML_RPC_Server
  • XML_RPC_Value
  • XML_Serializer
  • XML_Util

For more info on a package, you can consult the PEAR site and manual. Did you know that you can access a package's page by typing its name (case insensitive) in the URL after, like for example?

Tell your friends about this post: Facebook, Twitter, Google+

16 Responses

  1. Nice list Stoyan, I was wondering exactly what specific packages are covered, can I put that on the wiki?

  2. Sure, I was thinking of doing the same, only wondering where exactly ;)

  3. What do you think about doing something like this (only partially completed)

    I am then linking that from the home page, and adding a bit of information (from the PEAR page) on each package.

    If you think that’s a good way to present, then I’ll get the rest of the info and put it together :)

  4. Stoyan Stefanov’s Blog: The PEAR book…

  5. Looks good and I think it’s a very good idea to list details of what’s covered in the book! Only that not all items in the list are packages, so maybe we can group them. For example package Date, with sublist containing classes Date_Span and Date_Timezone, as they are not stand-alone packages, but are covered in the book and instantiated with new. Same for a few XML_XUL_* classes (which I actually omitted in the list). You can start the list with format you choose and I can help adding details.

  6. This looks like a great book and I will most probably order myself a copy… However, I would have liked to see articles about some IMHO more popular/important packages like e.g. “Auth”, “Mail”, “Cache/Cache_Lite”.

    For interesting classes like “Live_User” there is also a lack of documentation on the PEAR site, so it would have been nice to see these packages in the book. :-(

    But otherwise: great work!

  7. True, Fabian, you’re right. This book is more centered around something like working with (and displaying of) data, hence the covered packages – MDB2, DataGrid, Excel, PDF, XML, Web services. But you’re right, PEAR can always use more documentation and how-to-s on popular and/or interesting packages.

  8. Stoyan – You guys are ***SO*** cool! So, my link count is going up! Do you have any idea why? LOL! I am so enjoying it. Thanks, Stoyan, for taking me on your adventure! :)

    Did you find the link I left on Seth Finklestein’s blog for your book? Seth linked to a silly little article I wrote on the Walmart fake bloggers ( – wow, huh? lol!).

    So, I was reading his articles, which are, of course, amazing. He has an article about wanting to get *out* of the Wikipedia. So, in my comment, I mentioned your book and how Pear might be able to help him. ;-)

    Hope everything is turning out great with your book! Talk to you later, Amy :)

  9. Stoyan – I meant to link you to Seth’s article on wikipedia where I mentioned your book. Not my silly article. :) I am here testing out your coComment recommendation – way cool.

  10. [...] So what I’ve been up to recently? Having a bit of a break, I guess. First, I’m not currently writing a book, after the last one for which I completed my chapter back in June. That’s some free time (There is a very exciting book project on the horizon though, we’ll see). Then, I’m not working so much on our new house. Now (August) that my family is back from Bulgaria, and the two little princesses are running around, it’s next to impossible to do any construction work, however small. [...]

  11. Just bought your book. Great reading. But working with dates, I would have liked you to cover the conversion of dates from a timestamp in a database to the internationalized date for instance in a form and taking it back again. I think many developers struggle with precisely that aspect.

    Lars Olesen

  12. Read more in your book, and learned a lot. However, it is to bad that you on page 39 where you just explained how to set a custom debug handler to mdb2 only mentions the idea to prefix every select statement with explain and not show how to do it. The custom error handler has little value as it doesn’t add anything to the standard error handler. Perhaps a blog post about it :D

  13. Thanks Lars! I’m glad you like the book.

    As for the custom debug handler, I think there is an example that shows the value – the thing that counts how many times each query is executed. The example that I used is something I came up some time ago while doing performance optimizations on a site. Back then the project was using PEAR::DB and there were no custom debug handlers, so I had to hack its code a bit. When I tried MDB2, I liked the fact that you can do the same by using API provided by the package and without the need of modifying its code (easier for future updates, etc)

    Thanks again for your kind words about the book, I’ll try to address both of your suggestions in blog posts.

  14. Cannot wait to read more about the matters in your blog. You guys are brilliant :)

  15. [...] This is a follow-up to Lars’ comment about the PEAR book. In the MDB2 chapter I showed an example how you can create custom debug handlers in MDB2 and then gave a suggestion about a useful application of this functionality for performance tuning. Basically the idea is that your custom debug handler collects all queries that are executed during the life of a given script. Then, once the script finishes execution, the debug handler reports the stats that it has collected. In the book, the example is how you count the number of times each distinct query is executed, this way you can spot problems caused by the OO abstraction. For example, say you have a come class Users that has a method loadUser(), which abstracts the database work. While debugging with the custom error handler, you might figure out that without noticing, you’re calling this method in a few places and it makes the same repeating query(queries) over and over again. So you can now optimize/cache results and so on. [...]

  16. I has use your code from PHP Programming with PEAR, technorati cosmos. But there is a bug like this :

    Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\pear\Technorati\tech.php on line 22

    Please tell me how to fix it. Thank you.

Leave a Reply