Set Your Code on Fire, Professionally. Seriously, It’s a Bright Red Book About the Popular PHP Framework.
Besides learning how to use CodeIgniter, in this book, readers are going to learn how to develop a website using Agile programming techniques. At the same time, they put together a simple shopping cart website for a client.
What is CodeIgniter?
Compared to other languages, PHP has an abundance of frameworks (Wikipedia lists about 40- only Java comes close) available. One of the better-known ones is CodeIgniter that has been around since 2006. When I started looking into frameworks, CodeIgniter was one I considered before ultimately going with CakePHP. Back then, a lot of Cake developers seemed to move back and forth from Cake to CodeIgniter and vice-versa. There appears to be of late some discussion in the PHP community if frameworks are essential, especially after PHP creator’s Rasmus Lerdorf’s controversial presentation on framework performance — in which CodeIgnitor did very well. The central argument is in these discussions is whether the gains in coder productivity are worth the performance costs a framework entails. Myer tells his story of how, after building websites for years found himself with a lot of complicated code around that was challenging to maintain. Looking for a more straightforward way, he eventually settled on CodeIgniter. CodeIgniter’s most significant advantage is its speed– because you can control when you use it, there’s a lot of optimizations the experienced programmer can do. As well, unlike Symfony and Zend, it runs on web-hosts with only PHP 4 support.
Most of the above are covered in the first and third chapters. The first chapter “Welcome to the MVC world” gives an interesting overview of the evolution on the MVC (Model View Controller) pattern from its Smalltalk roots. However, NeXTstep/Cocoa and finally to its use in Ruby on Rails. Near the end of the first chapter, Myer gives an excellent run-down of the various frameworks he considered. He settles on CodeIgniter. Else this book would have turned out a bit differently. However I think he’s pretty honest about the pros and cons of the frameworks, CakePHP (1.1?) and Symfony, he considered.
Next, “A 10,000-foot view of CodeIgniter” gives a run-down on the framework, covers a lot of the built-in libraries. It coves downloading, installation and file layout, as well as some of the libraries, included. Readers learn to create models, controllers and views, ending with a basic “hello world” type application. By the end of these two chapters, readers are going to have enough background in CodeIgniter to get started building an application.
What makes this book different is the book also teaches Agile programming while teaching the framework. In the second chapter, “Agile Methodologies and Approaches”, the reader is given a quick overview of Agile Methodologies, as there’s several approaches with names like “Scrum” and “XP” (extreme programming) as well as a set of links to further reading. Past that, the reader is taken into the book’s project: a shopping cart application and the process of meeting with the client and building a list of requirements. Every few chapters end with a “sprint backlog” update and meeting with the client. The Agile programming aspect of this book makes it stand out a bit from the usual “Learning framework X”-type books.
Like a lot of introduction books, security seemed to be a bit under-developed. While the author does make mention of developing a secure application early on, security is addressed mostly in chapter 9, “Security and Performance”– which is primarily examples of securing the application developed over the previous chapters– with a bit on caching thrown in at the end. The author does give a list of websites with security tips, but I wish security had been worked into the application from the start. Case in point would be the usage of $_POST at several points in the book. Even CodeIgniter’s online manual cautions against this. While it might be less typing than “$this->db->escape(…)”, before updating something in the database, it would be something I’d expect to see in a book labelled “Professional.”
By the end of this 300-odd page book, readers will be familiar enough with CodeIgniter to develop their applications and use them as well as Agile methodology for building those applications. Granted, the website you create isn’t that fancy. All the major PHP frameworks– Zend, Cake, Symfony — have at least one book, now CodeIgniter has one too.