Review: CodeIgniter for Rapid PHP Application Development

Review: CodeIgniter for Rapid PHP Application Development

Got something to say?

Share your comments on this topic with other web professionals

In: Reviews > Book Reviews

By Nathan Smith

Published on February 12, 2008

Frameworks have become a hot topic in the world of web development. Their popularity stems from the notion of “convention over configuration,” automating mundane tasks so you can focus on more unique and exciting aspects of a project. One such PHP framework is CodeIgniter, an open-source project by EllisLab, the company behind the popular CMS ExpressionEngine. CI is an abstraction of the code that drives EE.

CI’s core download is bundled with a User Guide, but it is always helpful to have real world, hands-on examples. This is where the latest book by David Upton comes in: CodeIgniter for Rapid PHP Application Development, published by Packt Publishing. Weighing in at 240 pages, it is a concise guide to CI, in keeping with the same no-nonsense philosophy as the framework. Eschewing complexity, it strives for excellence with a small foot/files/includes/print.css.

Who is this book for?

This book would be a great resource for front-end developers who are familiar with PHP templates, and want to take their skills to the next level by applying MVC best practices. Experienced PHP gurus who are looking for a way to enhance their workflow would also find this book useful.

I fit into that first category. Though comfortable with PHP, I have heard enough horror stories about it (some even true) to know that I should adhere to best practices when writing interpreted code for the server. Shunning the dark ways of sloppy coding, David Upton guides you along the path of PHP enlightenment throughout this book.

What will I learn?

In Chapter 1, Upton defines some basic tenets which constitute a framework. If you agree with the presuppositions of the developers who built a given framework, it makes your job easier. Otherwise, in his own words:

It’s like trying to write a sales brochure using Excel, or do cash-flow projections using Word. Both can probably be done, but neither is the best use of your time.

You will come to appreciate Upton’s writing style—he does not mince words, but has a good sense of humor with a straightforward attitude.

Chapter 2 covers how to install and configure CodeIgniter, a quick and painless process. It does not require fussing with any php.ini, nor necessitate use of the command line. You simply put the CI files in the appropriate directory, and get down to brass tacks. Upton’s instructions cover the use of XAMPP on Windows to create a localhost sandbox. (Disappointingly, he neglected to cover Mac installation. If you are a Mac user, I would highly recommend checking out MAMP for local development.)

In chapter 3, Upton delves into the world of design patterns, specifically MVC: Model, View, Controller. Models talk to databases and conduct business logic, Views dictate the way in which information is displayed, and Controllers provide dynamic connectivity between models and views. Just as there are three different layers in client-side engineering (data, presentation, behavior), logical MVC separation makes code more manageable.

I appreciate the fact that Upton did a thorough job of explaining MVC, because this is the bread and butter of building web applications. Rather than assume an understanding of this concept, he covers it at a high level using diagrams, and then gets into the specifics of how CI tackles MVC.

Chapter 4 is devoted to Active Record. This allows you to write abstracted code which connects to a database. It supports a variety of databases, including MySQL, Postgre, and MS SQL. Upton explains how the dbdriver parameter tells CI which type of database you are using. CI then interprets your higher level code and passes it along in the appropriate syntax.

Upton has a nice approach to explaining databases. He shows how queries can be built long-hand using raw SQL code, and also explains how Active Record expedites the process. By seeing how much AR streamlines the workflow, you really gain an appreciation for the elegant nature of CI.

Chapter 5 covers the handling of web forms via CI. This includes preventing cross-site scripting, as well as validating data to ensure that it is of the correct type (for instance, checking to see that a phone input field accepts only numerical values). Once you get the hang of building forms, CI helps you repurpose that code for similar needs down the road.

The later chapters delve even further into CI. Upton shows how to create a file upload system, ideal for a site that runs on user-contributed content. Session handling and security are explained, as is building a utility that monitors the up-time of other sites. This could be useful in tracking the reliability of a small network, logging errors and latency problems as they arise.


Overall, this book is an invaluable resource for those looking to adopt the CodeIgniter methodology. The writing style is friendly and engaging, while still succinctly conveying what you need to know. It works in tandem with the already exhaustive official user guide, to provide a well-rounded coverage of the framework.

If you are interested in learning more about CI, I’d also recommend the following resources:

Related Topics: Programming, Planning, PHP

Nathan Smith is a goofy guy who enjoys practicing and preaching web standards. He works as a UX Developer at Fellowship Tech. He writes semi-regularly at SonSpring and Godbit. He has been described by family and friends as mildly amusing, but is really quite dull.