Programming PHP, 3rd Edition (O’Reilly)

Programming PHP continues to be an excellent book for any beginning or intermediate PHP developer.  Seasoned developers will certainly find plenty as well–I’m happy to say I found plenty of great  ”oh, cool!” moments reading through it.  As this title is now in it’s third edition, it is incredibly polished and beautifully structured.  In short, a perfect book for any PHP developer’s library.

Right from the start, the authors assure PHP was created for web development, and continues to be a powerful tool for constructing your latest ideas. The tone is generally pragmatic, and doesn’t go wandering off into some advanced topic before you are ready.  The first couple of chapters are about getting you hooked…showing new developers how easy it is to get started with the language. From there, they go into writing your own functions and diving into string manipulation.

PHP is rarely developed in a vacuum away from all of the other libraries, frameworks, micro-frameworks and whatnot that make it such an effective platform.  However, to avoid over complicating the topics, Programming PHP generally stays true to discussing “vanilla php” until you get into the later chapters.

The section of the Strings chapter on using regular expressions is easily worth the price of the book on it’s own, but they smartly introduce you to the more traditional string processing techniques first.

The chapters on Objects and Arrays are equally powerful, drawing on the previous chapters and going into just enough conceptual and concrete detail to be highly effective.

At this point, you are going to have a very rich understanding of the language, but haven’t seen much of how to actually build a web application in a while.  So, they take a chapter to do just–explaining exactly how you will can use html, forms and sessions to get data to and from your users.  Finally, they give a taste of the many types of database engines php supports directly including PDO, mysqli and even MongoDB!  So just half way though the book, and you have everything you need to truly be effective at building web applications.

From there, look forward to some fun with generating graphics and PDFs   Heck, there is even a 13 line script that converts images into color ascii art!

All PHP developers should read and understand the chapters on Security and Application Techniques–if just to keep these concepts in their minds while coding.  Developers who have been using PHP since the early days may find the sections on Web Services and Dates and Times particularly useful.

The book includes a giant appendix — essentially a concise manual for the language.  While many of us probably use the online docs, I remember this section being particularly useful when I was learning PHP from the first edition of this book over a decade ago.

Web development is a very large and constantly evolving field.  This book doesn’t try to make points diving into HTML 5, CSS 3 or writing complicated map-reduce functions in MongoDB–nor should it.  I would have liked to see a chapter on PHPUnit or any of the PHP QA tools–even if it replaced the chapter on fpdf.  Also, the Application Techniques showed how to build a simple template engine to introduce the concept–I would have liked to seen a simple MVC pattern demonstrated as well.

Regardless, the authors have done an amazing job of refreshing this iconic reference for the PHP language. I highly recommend it to anyone looking to learn more about PHP.

Creating Dynamic Web Pages
Publisher: O’Reilly Media
Released: February 2013
Pages: 540

Review of Facebook Application Development with Graph API Cookbook

Packt Publishing, 2011

by Shashwat Srivastava, Apeksha Singh

http://www.packtpub.com/facebook-application-development-with-graph-api-cookbook/book

Review by Dan Holmes, 18-Feb-2012

What is this book about?

Starting with just a Facebook account, a PHP host, and an SSL key this book will help you begin to understand what goes into developing applications for Facebook almost right away.  It assumes no previous knowledge of Facebook, so it will start small: app setup, authentication, getting simple metrics, etc.

Be aware, that some of the basic details regarding authentication and using the Facebook SDK’s have changed.  You will need to reference the Facebook developer documentation to fill in the new details.

But, by the end of the first two chapters, you will have everything you need to build a basic Facebook application complete with getting user information, creating posts, adding friends and uploading pictures into albums.

From there, you will also learn about how to use Facebook’s Social plug-ins–if you are just wanting to add feeds, like buttons, and other information to an existing web site.  From there, you will learn about how to add meta data to your own website to register it with Facebook’s Social Graph.

By the time you get to Chapter 10, the authors build a handful of standalone applications from the ground up.  This can be very helpful, so you can see all the pieces working together. The applications may also serve as inspiration for your own new ideas.  Don’t just start here though, it really assumes you have read the previous chapters. :-)

The final chapter prepares you to work with Facebook’s Open Graph Beta – allowing your application to interact with Facebook and user’s Timelines in new and exciting ways.

Be aware, I’m really just scratching the surface.  If you have been looking for a nice go-to reference for ways to take advantage of what Facebook offers definitely look at the Index.  I think most developers will have more than one “oooh” or “ahhh” moment.

Is this book for you?

Beyond what you can see from the index, this book provides a solid reference for any budding Facebook application developer.  For beginners and developer enthusiasts, the cookbook format will help you see practical, useful, living examples of what you can do with the Facebook SDK.  For more seasoned developers, it will provide a go-to reference when you are needing to do something new and just need a practical example to see how the pieces fit.

If you have an idea for a new facebook application and you know even a little PHP you are ready for this book.  The book does assume you have web development experience, so it won’t teach you HTML or Javascript.  But, if you are a web developer from some other language and don’t wish to write your application in PHP, you will still get what you need from the code examples and screenshots.  Many of the examples are in Facebook’s Javascript SDK with maybe a little jQuery thrown in so much of the book will apply to you directly anyway.

How long will it stay relevant?

Facebook is still a maturing platform and as such it is constantly changing their API and requirements.  Therefore, it’s difficult to predict how long ALL of these examples will remain current.

For example, the examples for authentication and setting up the API’s will need a bit of updating to actually work.  Facebook did update their authentication API’s in the past months, so many of the examples won’t work as shipped.  There is very little discussion towards using HTTPS connections in your application, but at the moment it’s mandatory for canvas applications.  Also, the examples use the getSession() method which has been replaced getAccessToken().  So, be sure to check the offical documentation.

That being said, it is a large collection of examples which still maintain a lot of relevance and usefulness.  It should provide an excellent companion to the official Facebook documentation.

Language and Accuracy

As an American reader, I would occasionally find a word that seemed a little out of place but this is rare and far between.  As a developer the actual discussions, source code and walk throughs are very clear and concise.  Each recipe tells you what you are about to learn, what you need to have, what you need to do and what you should expect.  The format makes for an easy and understandable read but is also very useful when accessed randomly as needed.

Complete Source Code, eBooks

Even in Chapter 10, when you are building complete, standalone applications you won’t find pages and pages of unannotated source code.  At most, you may get 5 or 10 lines in a row, usually just 1 or 2.  That said, Packt offers the complete, source code for all of their examples neatly organized by chapter.  So, if you are reading and want to pull back a bit and see the examples in context, you certainly can.

This is my first development e-Book, and I was a little concerned how the format would turn out.  The book is available in .pdf, mobi and epub formats…and the format worked very well, even on smaller devices.

It’s all about the SDKs

One of the good things about this book is that all of the examples are in vanilla PHP, with only the Facebook PHP-SDK, HTML, Javascript and maybe a little jQuery.  You can read them, they tell you exactly what is going on, and it’s understandable.

It isn’t about using the latest PHP and JS micro frameworks, using MVC or any of that–none of that is this book’s job.  Remember, this is PHP–a language that seems to have at least one more framework or library than it has developers who use it.  That being said, the cookbook format and the the concise examples give you the concepts you need to fold them into your own framework or micro-framework.

If you are looking for a reference that walks you through a large number of ways for your software to interact with Facebook, be sure to check out this book.  Be aware that authentication requirements have changed since those areas of the book were written.  So, if you run into issues, be sure to reference the official Facebook documentation to understand what needs to be changed.

About me and my perspective

I’m a professional PHP Application developer with 10+ years in PHP as well as other languages and environments.  I am a ZCE in PHP 5 and 5.3 and help organize a PHP User Group in the Kansas City Metro area.  While I would not call myself a Facebook developer, I had started building one Facebook application before reading this book and wish I knew about it earlier.

PHP 5 Objects, Patterns and Practice, reviewed on the dot.

Part shameless plug, part book review notification: I just wanted to announce that my review of PHP5OPP is now available on slashdot.org. I loved this book so much, and believe in it so completely that I wanted the review to get as much exposure as possible.

If you have been wanting to give your programming skills an object oriented upgrade but don’t really know where to take the plunge–go check out my review of PHP 5 Objects, Patterns and Practice from Apress.

Free PHP 5 Book

Pretince Hall is giving away thier ‘PHP 5 Power Programming‘ book in PDF form for free! The book is written by Andi Gutmans, Stig Sæther Bakken, and Derick Rethans.

EDITOR: Read more for all the details, including the table of contents.

It is 720 pages long, and the table of contents contains:

Foreword by Zeev Suraski
Preface: Introduction and Background
Chapter 1: What Is New in PHP 5?
Chapter 2: PHP 5 Basic Language
Chapter 3: PHP 5 OO Language
Chapter 4: PHP 5 Advanced OOP and Design Patterns
Chapter 5: How to Write a Web Application with PHP
Chapter 6: Databases with PHP 5
Chapter 7: Error Handling
Chapter 8: XML with PHP 5
Chapter 9: Mainstream Extensions
Chapter 10: Using PEAR
Chapter 11: Important PEAR Packages
Chapter 12: Building PEAR Components
Chapter 13: Making the Move
Chapter 14: Performance
Chapter 15: An Introduction to Writing PHP Extensions
Chapter 16: PHP Shell Scripting
A. PEAR and PECL Package Index
B. phpDocumentor Format Reference
C. Zend Studio Quick Start
Index

I have not gotten a chance to look through it yet; as soon as I found out I rushed over here to tell everyone. Also if it’s free how could you go wrong.

ENJOY!
Al

Pro Apache Book Review

Pro Apache, written by Peter Wainright, is a behemoth of a resource for everything you ever wanted to know about Apache. The name implies “Professional” and that is the intended audience of this book. People playing around with home websites probably won’t find this information useful. If, however, you are in charge of your company’s important web servers, I think you’ll find this book extremely helpful. It covers a lot of content in far more detail than you’ll get from the online Apache documentation.
The book covers both Apache 1.3.x and 2.0.x. One of the early chapters discusses the differences between the two. Throughout the book, the author usually points it out whenever there is a difference in how they operate or whenever there is a configuration directive that is only found in one of the versions.

I don’t recommend trying to read the book straight through. A lot of the early chapters talk about how nitty-gritty details of how Apache functions. These chapters, while informative, can be a bit boring. If you really want to get to the meat and potatoes, skip to the chapter that you’re most interested in. Want to know about Name Based vs. IP based virtual hosting? Skip to chapter 7. This chapter has everything you want to know about virtual hosts, with a lot of extra features you might not have known about, such as the ability to assign and dedicate apache child processes to specific virtual hosts.

There is a specific chapter dedicated to performance tuning, of course. It talks about the different process models available and explains all of the performance enhancing configuration directives in detail. In stress testing my own servers, a lot of this information was very handy. If this chapter falls short in any way, it is the lack of information regarded stress testing tools available. If you want to stress test your dynamic web applications, a simple search on the web will find you far better solutions than the benchmark tool he talks the most about in the book (ab). He briefly mentions two others in the book, but I felt he could have done a better job of explaining why you’d want to use them.

The chapter on dynamic content was the one chapter that left me a little perplexed. He talks about CGI, the best ways to run CGI scripts, running server side includes (SSI), running Perl scripts, and running FastCGI for increased speed. However, there is not a single PHP reference in this chapter. He doesn’t mention PHP until the final chapter of the book, where he talks about extending Apache with 3rd party modules. I understand that this isn’t a PHP book, but I felt he could have talked about PHP a little bit more than he did.

Other chapters, of which I just briefly skimmed, cover topics such as user authentication, SSL, log files, fault tolerance and clustering, proxying, caching, and server security. Many of these were very interesting, and I plan on using this book as a reference whenever I need more information on any of these topics.

If you run a high-load web server that needs a lot of customization or performance improvements, this is a great book to take a look at. Almost everything you need to know about Apache is in here and most of it is explained very well. If you are a beginner, you may want to look elsewhere. This book is meant for professionals and hardcore enthusiasts that want to push Apache to its limits.

A couple of links….
Publisher’s information on the book
Amazon.com Link

- Doug

HOWTO : Writing a book review

Our friend Janet Crosbie over at Apress has written up a nice resource for those of you struggling to write a book review. In it she provides ideas, links and examples that any reader may find helpful in preparing their review. Read on for more!

If you would like to post a Book Review on our site, simply log in, select submit news from the Main Menu and type away. You can set the topic if you like, or just let me set it when I go to approve it.

Thank you Janet, for putting this together for us!

Apress encourages user group members to write book reviews that are comfortable and fun to write. We realize that time may be limited for working professionals, so we appreciate any thoughtful and constructive reviews of our books.

We suggest posting book reviews wherever relevant: Amazon, Slashdot, your blog, your buddy’s blog, Barnes and Noble, JavaRanch, or your user group’s site-just to name a handful.

Whenever possible, a review should mention chapter features, describing one or several chapters at a time. Additional topics might include:

  • How will this book help you with your work (or hobbies)?
  • What sets it apart from other books you’ve read?
  • Would you recommend it? To whom?
  • What was your favorite chapter or section?

Many reviewers enjoy sharing what worked (or didn’t work so well) for them in our books. And review length is up to the writer-we typically see reviews that range from a paragraph to a few pages. Here are a few examples:

If you want to challenge yourself, take a look at some examples of Slashdot reviews:

If you’re more limited on time, follow the example of some Amazon customer reviews:

Here are some fine examples of reviews posted on User Group sites:

  • http://www.denvervisualstudio.net/Reviews/Books2004/Book10052004.htm
  • http://www.mainebytes.org/bookreviews.asp
  • http://oakland.pm.org/reviews/apress_perlbeg.html
  • http://www.denverjug.org/reviews/DecompilingJava.jsp

And some Blogs that feature book reviews:

  • http://codegeneration.net/br_list.php?search=publisher&id=7
  • http://www.adboyd.com/reviews/apress/CubeFarm.html
  • http://www.crazedfanboy.com/npcr/popculturereview222.html
  • http://msmvps.com/williamryan/archive/2004/12/21/26681.aspx