views:

17645

answers:

25

I'm interested to find out what Stack Overflow believes the best PHP book is - both for those who are beginners to web programming as well as those who have previous programming experience (they don't have to be same book). "Best" includes being both reasonably up-to-date and encouraging best practices for secure, modern, PHP programming.

There seems to be a lot of books out there and unlike other languages there doesn't seem to be a single well-regarded book and it's hard to separate the wheat from the chaff, so I'm interested to see what the community believes is good - both for personal use and for future recommendation to others.

Thanks.

To clarify: I know of the PHP manual which is largely a reference, not paper, makes little comment as to proper style and is not what I'm looking for.

+6  A: 

I've always liked O'Reilly's titles, so I'd recommend their Programming PHP book. It's authored by Rasmus Lerdof, PHP's creator, along with other PHP industry experts, so it could be considered pretty authoritative.

David Precious
is it still as praised in light of other, newer books?
Beau Martínez
A: 

For a language reference, it's really hard to beat the website - it's also quite easy to get a local mirror of the relevant manual section for yourself.

Most of the rest of what you need to know is covered by other software engineering texts, like use of testing, or refactoring.

Alister Bulman
+4  A: 

I like Schlossnagle's Advanced PHP Programming. It's a great reference with good worked examples for things like session handling, RPC, unit testing, caching, profiling and even extending the language engine. If you already know PHP and are using it for a large project it is a very useful book to have around.

Colonel Sponsz
+1  A: 

My choice is http://php.net/manual/en/ It contain very useful user comments on every page. For best practices I recommend read manuals for various PHP frameworks and libraries (like symfony or Propel) because PHP itself is not a “well-formed” language and such great tools will help you to learn best ways of writing of PHP code.

Sergei Stolyarov
half of the time those user comments are garbage sprinkled with noob
but i mean yea, i check the php.net site more then i refer to any 1 php book
he said that this isn't what he was looking for.
Mg
+8  A: 

I'd recommend that every PHP programmer reads Essential PHP Security By Chris Shiflett

Matt Lacey
+4  A: 

I tend to learn by doing, so I enjoyed the O'Reilly PHP Cookbook and of course the php.net manual (if you download the windows chm, be sure to get the extended version with comments)

adam
Agreed - if you know what you want to do with your site, PHP Cookbook lets you jump directly to code that solves your problem.
John Fiala
@John Fiala but it won't learn you the basics
Omar Abid
A: 

Pro PHP Security is one of the best PHP books I've read in a while.

Bob Somers
+4  A: 

Personally, I like the SitePoint PHP books. I read them, they are really nice and can be used "out of the box".

And then of course the PHP manuel (mostly for searching for some functions):

Veynom
+1  A: 

I think the best book for PHP is "Programming PHP" published by O'Reilly and written by Rasmus Lerdrof. although I liked "PHP & MySQL bible" published by John Wiley, but "Programming PHP" was more effective whilst it had less pages.

farzad
+20  A: 

PHP In Action

Covers pretty much every modern web development topic including:

  1. Object Oriented Programming in PHP (really in depth.. it's like half of the book)
  2. Unit Testing
  3. Refactoring
  4. Web Interfaces - Templating, Smarty, Pure PHP templates
  5. Model View Controller
  6. Input Validation
  7. Handling Database Connections and making them "globally" available in an OOP architecture
  8. Data Class design (for MVC again)

One of the best programming books I've read even though I knew most of that stuff anyway, and I imagine one of the best introductions to OOP for any experienced PHP developer out there wanting to get out of the procedural rut.

David McLaughlin
DEFINITELY one of the best PHP books. It teaches you much more than just the language, but how to use it like a guru.
CrazyJugglerDrummer
Good book but I'm not sure is ideal for programming newbies.
JDelage
A: 

Personally I hve recently read "Pro PHP: Patterns, Frameworks, Testing and More" by Kevin McArthur (ISBN: 9781590598191). Out this year so pretty up to date. Excellent source of info for those who want to expand their knowledge of PHP.

Jon
A: 

Of course it depends on your requirements. If you've gotten to grips with the syntax, and you're looking to develop larger applications, or, you're looking to really harness the OO approach of PHP5, I'd reccomend the Matt Zandstra book:

http://www.amazon.com/gp/product/1590593804/ref=cm_cr_pr_product_top

It really cements the fundamental aspects of application development, and, goes great with the new Zend Framework (which I'd also recommend).

Andrew

Andrew Taylor
+3  A: 

This isn't a pure PHP book, but the book that did influence how I write php code the most is "Patterns of Enterprise Application Architecture" by Martin Fowler. It's a nugget of gold for someone that wants to learn to structure and develop object oriented code in a languages such as PHP, Java, C#.

thr
+4  A: 

Larry Ulman's PHP5 Visual QuickPro Guide is what helped me get started in my progress from a hobbyist to a professional developer some eight years back (well, it was an older edition, not this one exactly). You wouldn't expect it from the title, but it's actually well-written, very readable, and very usable for a beginner, without descending into talking-down or dumbing-down the material. Check the amazon reviews for it and subsequent editions.

Looking at publishers, Apress and Pragmatic Programmer books in general are usually pretty good, not to mention O'Reilly. I hear Peachpit Press puts some good quality stuff out too, but I don't have any of their titles, so can't speak with confidence to that.

Oh, and Safari Books has a really cool subscription program where you get unlimited access to a huge number of technical books from O'Reilly and a bunch of other publishers online.

Aeon
The Visual QuickPro Guide Books are really good. Can't believe no one else thought the same.
The Pixel Developer
+4  A: 

PHP objects patterns and practice, http://www.apress.com/book/view/9781590599099 its the best programming book I ever read.

A: 

Try

link text

Or other book by the same author or indeed publisher.

Julian
+23  A: 

I'll second (or third) "PHP Objects, Patterns, and Practice" by Matt Zandstra (get the newer 3rd edition) as one of the best books on OOP ever, not just on PHP. I recommend it to everyone moving to PHP from another language, or anyone new to OOP.

Another great object-oriented programming reference is Bruce Eckel's "Thinking in Java" which you can download for free on the web. Yes, I know, it's not a PHP book, but most of the same principles apply, and you can translate most of the examples in the book from Java to PHP > 5 in little time since PHP5's object model is so much like Java's (with some interesting differences).

Jough Dempsey
There is actually a 3rd addition coming out soon: http://www.amazon.com/PHP-Objects-Patterns-Practice-Third/dp/143022925X/ref=dp_ob_title_bk
John Isaacks
A: 

PHP in Action is one book i DONT recommend for someone who wants to learn pure php. Neither does it cover simple php constructs, neither does it cover any advanced topics about php. Anytime you feel that an interesting/advanced topic has started, it stops there and starts off with something else. There is only mention of patterns, OOP concepts, Agile concepts etc etc that you can read off from some book dedicated to the subject.

What a waste of money considering the fact that the last 3 "... in Action" books that i have ready have surely turned out to be the best references on the topic they talk about.

A: 

For an in-depth view on PHP5 I'd recommend (besides the other honorable mentions in this thread):

Stefan Gehrig
+1  A: 

I would suggest PHP Object-Oriented Solutions by David Powers

PHP Object-Oriented Solutions

* Teaches the fundamentals of OOP (Best Explanation on OOP)
* Simple projects show how OOP concepts work in the real world
* Pre-packaged scripts can easily be added to your own projects

What youll learn

* PHP features, such as the Standard PHP Library (SPL), that are poorly documented or ignored by existing books
* How to develop classes of their own
* OOP in easy-to-understand language without getting bogged down in dense theory
* Solid foundations for developers wishing to delve more deeply into OOP
* How to leverage the strengths of OOP as a means for creating reusable code that can be used successfully within a procedural context
* How to code for both PHP 5 and 6
Ibn Saeed
A: 

Really different topics of books. I have Programming PHP by Lerdorf which I can say deals with the basics of the language and is propably great if you have to know the language. I wolud recommend for anybody who's not an advanced PHP coder to read Gilmore's Beginning PHP and MySQL from Apress. It has lot's of great content and covers a lot.

+4  A: 

As others said, PHP Objects, Patterns, and Practice (2nd edition) is a good start point if you're developing in PHP, but if you haven't read them, I'll go back to the fundamentals. First Design Patterns: Elements of Reusable Object-Oriented Software by the Gang of Four to learn the common patterns (decorator, composite, facade, singleton...) in software development (some of them are also explained in "PHP Objects..."). Then Patterns of Enterprise Application Architecture by Fowler which extends the basic patterns to create more complex patterns like MVC.

Then you could also take a look to some of Misko Havery videos, like Design Tech Talk Series Presents: OO Design for Testability . He is the Agile Coach at Google and his videos about testing are really illuminating not only in why you should code for testability but also why you should do OOP.

By that moment you will realize that your code is not so good and you'll thing about refactoring. The Refactoring: Improving the Design of Existing Code also by Fowler is considered the bible for refactoring, but I prefer Working Effectively with Legacy Code by Michael Feathers.

Sergi
A: 

Hello, guys. What do you think about Apress's - "PHP for Absolute Beginners" and "Beginning PHP and MySQL: From Novice to Professional, Third Edition", which is better for absolute beginners?

Mamaduka
+1  A: 

For absolute beginners I'd recommend Head First PHP & MySQL. It shouldn't be the last PHP book you read if you want to be a professional web developer, but it covers all the basics so it's a good place to start.

One aspect of the book that I really enjoyed was the attention to basic security concerns. It starts off with a very simple site design, then shows how an attacker might exploit the weaknesses of that design and what you can do about it.

Bill the Lizard
A: 

A good solid reference manual is a great tool especially if it has practical, real world examples, rather than the sterile classroom ones which don't really match the design you need for your site / app / script. Heres a couple of good ones :

To start with PHP MySQL eBook