As I told everyone about a week ago, I am currently writing a book about CodeIgniter. And so far, it’s really going quite well.
I’ve decided to post a bit of the preface here, just to give you all a taste for how the book is written and what to expect from it.
Any comments will be greatly appreciated.
Elliot
Preface
As PHP and other server-side languages began to grow in popularity, a new idea within the development world began to emerge: ‘Frameworks’.
Originally, they were a way of having a ‘skeleton’ application to start with when developing a web application. They contained all the basic functions you’d normally write for every web app, like database connectivity and a basic separation of your code.
When most people start developing using PHP or any other server-side programming language, they very rarely think about using a framework if they’ve never used one before. But I believe that a solid framework is integral to building any good web application; hence the reason for writing this book. Frameworks separate your code and put it in ‘logical’ places, in a simple structure. This is a fantastic method of working, because if something goes wrong in your code, it’s much easier to find out where the error occurs if your code is split up into smaller chunks. And, if someone else takes a look at your code, the structure will make ‘sense’ to them too, so your application will benefit from a much easier learning curve.
Soon enough PHP frameworks began to sprout from everywhere, each serving slightly different purposes, but essentially, all doing the same basic job. There are possibly around 30 different PHP frameworks at the time of writing this…
But choosing one isn’t easy. You have to consider which one does the things you need it to, is it flexible enough to change? Can you use it for commercial purposes? Does it scale well? Is the framework well documented? Does it have a wide user base and somewhere to ask questions?
After evaluating all these questions, and searching for the ‘best’ framework, I came upon CodeIgniter, which really does a fantastic job. But you want to know why you should choose CodeIgniter over the vast array of other frameworks out there right?
Why CodeIgniter?
Firstly, I don’t want to pretend that CodeIgniter does ‘everything’ that you might need a framework to do; mainly because everybody has different needs from a framework. But, it does do an awful lot of the things you need straight out of the box, without a huge overhead of a bloated codebase.
CodeIgniter is very ‘light’ – a computing term which basically means that it doesn’t require a huge amount of resources to run. This is great because it cuts down on costs. You don’t need a very powerful webserver to run it.
CI saves you a huge amount of coding time, and it’s licensed fairly to allow use for both personal and commercial use without any worries about licensing fees down the line.
It’s been tried and tested by hundreds of companies around the world and is used by design agencies every day to power their client’s applications.
“Because CodeIgniter ships with many of the same kinds of scripts that are common to any app, it lets you focus on the 20% that’s unique to your project and not worry about the 80% that’s identical to every other dynamic site (database queries, input validation, XSS filtering, etc.) As a result we can provide the same level of high-quality work in a fraction of the time it would take to write it all from scratch. We win and our clients win!”
Nathan D Huening – Onwired.com
There is a huge community behind CodeIgniter, with an excellent User Guide, and a vibrant forum full of clever geeks waiting to answer any questions you might have.
This community is also host to a few great quality CodeIgniter blogs with some fantastic resources and articles. Here’s a few I’d recommend reading:
• Derek Allard (http://www.derekallard.com)
• Michael Wales (http://www.michaelwales.com)
• Elliot Haughin (me) (http://www.haughin.com)
Who is this book for?
This book is aimed at web developers who know most things about XHTML, and a little bit about server-side programming languages preferably PHP.
But, if you’re not too clever in the PHP department, don’t worry!
On this book’s website, there is a great list of tutorials to get you started with PHP and MySQL. As well as this, there are some books I’ve recommended to help you get started with server-side programming languages too.
Once you’ve finished this book, you should know CodeIgniter inside-out, and be able to build rich web applications using this great framework. If you’re just starting out with PHP, then this book will also build your knowledge of the language, and introduce you to good programming practices such as ‘Object Oriented’ and ‘Model-View-Controller’ styles of programming.
If you’re already a seasoned PHP developer, then this book will help you break some of those nasty habits you’ve built over the years, and get some good, modern, clean standards into your code. Also, this book will cover some very advanced topics in the later chapters; these should inspire you as to what CodeIgniter is capable of on a mission-critical enterprise scale.
What’s in this book?
This book consists of 25 chapters varying from the simplest of tasks, to enterprise level CodeIgniter applications. If you are already knowledgeable of PHP and MySQL development, then you can skip to the chapters that are most relevant to you.
Throughout this book there will be snippets of code. All of these can be found on the book’s website (see next section).
Chapter 1 – Installation
CodeIgniter requires a webserver to run. This chapter shows you how to install a webserver which matches all the requirements to run CodeIgniter.
We’ll start by looking at a ‘bundled’ package, containing all of the applications required for your webserver, and then look at installing each of the components individually.