Book Image

FuelPHP Application Development Blueprints

By : Sebastien Drouyer
Book Image

FuelPHP Application Development Blueprints

By: Sebastien Drouyer

Overview of this book

Table of Contents (13 chapters)
FuelPHP Application Development Blueprints
About the Author
About the Reviewers


The main idea behind FuelPHP Application Development Blueprints is to teach you FuelPHP's basic and advanced features by building various projects of increasing levels of complexity. It is very result-oriented; at the beginning of the chapters, we specify the application we want to build, and then we progressively implement it by learning how to use new FuelPHP features along the way. Our approach will therefore be very practical; a lot of concepts will be explained using code examples, or by integrating them directly into our projects. Thus, it is important to highlight that there will be a lot of code and you should be comfortable with reading and understanding PHP and HTML. As we will use them from time to time, having some knowledge about server/system administration and some foundation in JavaScript, jQuery, and CSS will be an added advantage.

Though this book is for intermediary to advanced web developers, any prior knowledge of the FuelPHP framework, or any other PHP framework, is not required. In order to understand this book, you don't have to know common concepts such as MVC, HMVC, or ORM. We take into account this shortcoming some of you might have, and important notions will be explained. We won't explain all of those in the first chapter though, as we want this to be as painless as possible; we will instead approach them when they become necessary for the project completion.

The ultimate purpose of FuelPHP Application Development Blueprints is to give you the ability to build any project using FuelPHP. By the end of this book, you certainly won't know every little detail of the framework, but you will hopefully have the necessary toolbox required to implement complex and maintainable projects.

What this book covers

Chapter 1, Building Your First FuelPHP Application, covers the very basics of the FuelPHP framework; how to install it, how to configure it, how it is organized, and its main components. Along the way, we will generate our first FuelPHP application using the oil utility and tweak some files, in order to illustrate how things work.

Chapter 2, Building a To-do List Application, focuses on FuelPHP's ORM and debugging features. We will illustrate these features using a lot of examples, and then implement a small to-do list application. We will also use some JavaScript and jQuery to send AJAX requests.

Chapter 3, Building a Blog Application, will teach you how to generate and tweak an administration interface easily, how to create your own modules and tasks, how to manage paginations easily, and how to use the Auth and Email packages. We will create a blog application implementing all these features.

Chapter 4, Creating and Using Packages, will approach the FuelPHP package system. This is a rather short chapter; we will first try to protect our website from spam bots by installing an existing package, and then create our own original solution by creating a new package.

Chapter 5, Building Your Own RESTful API, covers more advanced subjects such as building a JSON API, using language agnostic template engines, allowing user subscriptions, and implementing unit tests. To illustrate this, we will create a responsive micro blogging application featuring a public API.

Chapter 6, Building a Website Using Novius OS, will quickly introduce you to Novius OS, a FuelPHP-based Content Management System. Using such a system can greatly speed up the implementation of complex projects.

What you need for this book

The applications in this book are based on FuelPHP 1.7.2, which requires:

  • A web server: The most common solution is Apache

  • A PHP interpreter: The 5.3.3 version or greater

  • A database: we will use MySQL

FuelPHP works on Unix-like and Windows operating systems. The mod_rewrite Apache module and some additional PHP extensions are recommended; the complete list is available at

Who this book is for

This book is for intermediary to seasoned web developers who want to learn how to use the FuelPHP framework and to build complex projects using it. You should be familiar with PHP, HTML, CSS, and JavaScript, but no prior knowledge about MVC frameworks is required.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

  • Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Remove APPPATH/classes/controller/welcome.php as we don't need this controller anymore."

A block of code is set as follows:

echo Form::checkbox(
        isset($monkey) ? $monkey->still_here : true

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: " Click on the Generate button."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from:


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.