Open Source PHP Books
PHP has been at the helm of the web for many years. It is an extremely popular, interpreted scripting language that is ideally suited for web development in part because it has an approachable syntax and supports different operating systems. This language powers millions of web sites on the net and is extremely well supported by its user community.
PHP is also used as a general-purpose programming language. PHP code can be executed with a command-line interface (CLI) and to implement standalone graphical applications. CLI PHP programs often automate common tasks such as testing, deployment, and application administration. The language offers a very complete set of object-oriented programming features as well as support for functional programming. The latest TIOBE Index ranks PHP in 7th place, behind Java, C, C++, C#, Python and Visual Basic .NET.
The language is released under a non-copyleft free software license / open source license. The latest stable version (7.1) adds lots of new features.
This compilation focuses on the PHP language with 6 strong recommendations. There are books here for beginner, intermediate, and advanced programmers. All of the texts are, of course, released under an open source license.
We have published a series covering the best open source programming books for other popular languages. Read them here.
By Josh Lockhart, Phil Sturgeon (76 pages)
PHP: The Right Way is an easy-to-read, quick reference for PHP best practices, accepted coding standards, and links to authoritative tutorials around the Web. It aims to introduce new developers to some topics which they may not discover until it’s too late, and seeks to give seasoned developers some fresh ideas.
Topics covered include coding practices, dependency injection, databases, templating, errors and exceptions, security, testing, virtualization and more.
The book has been translated into German, Spanish, French, Italian, Polish, and many other languages.
The book is released under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license. It is available to read online, and in PDF, EPUB and MOBI formats.
By David Sklar, Adam Trachtenberg (640 pages)
PHP Cookbook is for programmers who need to solve problems with PHP. It’s a collection of problems, solutions, and practical examples. The book contains a unique and extensive collection of best practices for everyday programming dilemmas. It contains over 250 recipes, ranging from simple tasks to entire programs that demonstrate complex tasks, such as printing HTML tables and generating bar charts — a treasure trove of useful code for programmers, from novices to advanced practitioners.
By Mario Lurig (164 pages)
PHP Reference Book: Beginner to Intermediate PHP5 is a collection of over 250 PHP functions with clear explanations in language anyone can understand, followed with as many examples as it takes to understand what the function does and how it works. One of the best books to keep around as a PHP reference.
This PHP reference includes numerous additional tips, the basics of PHP, MySQL query examples, regular expressions syntax, and two indexes to help you find information faster: a common language index and a function index.
This book is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License.
By Andi Gutmans, Stig Bakken, Derick Rethans (720 pages)
In PHP 5 Power Programming, PHP 5’s co-creator and two leading developers show you how to make the most of PHP 5’s industrial-strength enhancements in any project, no matter how large or complex.
Their unique insights and realistic examples illuminate the language’s new object model, powerful design patterns, improved XML Web services support, and much more. Whether you are creating web applications, extensions, packages, or shell scripts, or migrating PHP 4 code, here are high-powered solutions you will not find anywhere else.
Review syntax and master its object-oriented capabilities, from properties and methods to polymorphism, interfaces, and reflection.
The book enables users to:
This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later.
By Giorgio Sironi (61 pages)
This practical testing book is aimed at PHP developers and features articles from the author’s Practical PHP testing series. It also includes a chapter on TDD theory, code samples, and sets of exercises.
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
By Wikibooks (123 pages)
Programming PHP is billed as a comprehensive guide to programming in the language. It covers the basics of the programing languages before moving on to some advanced PHP including object oriented programming, templating, libraries, frameworks, and security.
The text is available under the Creative Commons Attribution-ShareAlike License.
Here are good free-to-download programming books which are not released under an open source license.
PHP Pandas – aims to teach the reader how to be a web developer.
Hacking with PHP – has the goal of making the task of learning PHP something fun that you don’t have to worry about.
The Underground PHP and Oracle Manual – for PHP programmers developing applications for Oracle Database.
PHP Essentials – cover all aspects of PHP.