FuelPHP (1)


Book Review – Learning FuelPHP for Effective PHP Development

I’ve been playing around with FuelPHP for a while and despite the fact that I haven’t used it in production, it has been on my watch list ever since I first saw it. When I saw the new book about FuelPHP by Ross Tweedie, I was eager to read it – here’s my feedback about. If you just want to buy the book, you can get it at Amazon or directly from Packt Publishing.

About the book

The book has about 80 pages of actual content and covers these topics:

  • Chapter 1 – A few words about the history, some ideas behind FuelPHP and a good bit of theory.
  • Chapter 2 – Installation using the console script and a few words about alternative methods like GIT.
  • Chapter 3 – You’ll find information about the architecture in this chapter, (H)MVC, Configurations etc.
  • Chapter 4 – Shows you how to create models, controllers to build a simple blog application.
  • Chapter 5 – A list of packages you can find in the internet as well as a quick introduction showing you how to create your own package.
  • Chapter 6 – A few advanced topics like unit testing, routing concepts, custom oil (the FuelPHP console tool) tasks and profiling.
  • Chapter 7 – briefly covers the FuelPHP community and where to find more information about FuelPHP if you need it.

Targeted Audience

Without having read who the author actually targets, to me it feels like you’ll have to know quite a bit of PHP and some of the tools you use when writing software. At the beginning, you’ll have a nice overview where you can get a good understanding for FuelPHP and why yet another framework does make sense. The author also starts to use some words like closures, singletons, multitons pretty quickly. There are a few words explaining it, but I don’t feel I’d have actually understood it, if I haven’t worked with these things before. Not every person learns the same way, but I’d have liked to see a few links where I could actually see some example code of a multiton pattern.

Not the fault of the author, but software changes and usually much quicker than paper does. The book seems to have used version 1.6 as well as 1.7 when writing his book. I started straight with the current version which is currently 1.7.1. The good news, it will work just fine, even if the book is focused on 1.6. Not related to the book but more about FuelPHP, version 2.0 has been announced a while ago. The author also covers some changes we’ll see and that’s a bit of a downside to me. I do like everything that will change, but it makes me want to skip the 1.x version.

The bad sides

The author seems to be a skilled developer and likes to write software. I believe that, because I see some similarities with my own behaviour. The book covers quite a few things, things like GIT which are great (imho), but the explanation will hardly be good enough for someone who hasn’t worked with it before. I’d have recommended to keep that part in a blog and simply link to it. As soon as you run into an issue with GIT, you’re on your own. Although, I tried to go through the book without setting up a repository and it worked fine.

There are other situations, for example in the installation where the required PHP modules are described, but not with a name you can use to find the actual PHP extension you’ll need. Luckily that shouldn’t be an issue since FuelPHP doesn’t require much.

While FuelPHP works on different webservers like Apache, Nginx, IIS and probably a few more, most of the book is focused on Apache and *nix. There are a few shell commands that you won’t be able to run on a Windows computer, at least if you don’t want to play around with Cygwin or something similar.

Here’s a list which I think should be improved if there’s going to a be a second edition:

  • What the heck is a “Temporal ORM”? I do know quite a bit about SQL, ORM but was surprised to see a term right at the beginning of a book which is completely new to me. Luckily for me, Google also has only 36 results about this expresison
  • There are some magic commands in the book. While I understand their benefit, I’d recommend to leave them out and focus on the actual FuelPHP part. An information box with a sentence or two and a link would have been sufficient.
  • Probably something the publisher should improve. Just like my books, the code formatting could be better – I’ve seen worse but perfectly indented code is nice! I’d also recommend to highlight the line that actually matters.
  • I was sometimes confused about instructions, they were in the middle of a step by step procedure but sounded quite theoretical.
  • Make sure things are complete, when writing that you simply have to add a package to composer.json to install a new module, that’s incorrect, you’ll have to run composer update too. These things are small, but details matter, especially to beginners

You’ll find a few more situations, but after all I like the book and don’t want to give you an impression that’s worse than I think it should be.

The good parts

I like the started, the introduction about FuelPHP. I often ask myself: Do we really need this? Whether it is a PHP framework, a new Linux desktop. You’ll get a good feeling about what FuelPHP is about.

The demo application is perfect, it shows you how to create models in no time, how to run migration scripts to manage the creation but also the change of the database structure. It quickly covers the controller part, a few words about models and their relationships and bit about the output. You’ll also learn how to create a module and a package, their difference is well explained but will change in v2.0 as far as I know.

Should I read this book?

It depends on your background – I wouldn’t recommend it if you’re a PHP programmer who hasn’t worked with namespaces, databases before. But please keep in mind that this is a short book of only about 80 pages content. FuelPHP might have deserved a bit more but the shortness was nice – at least for someone like me who has worked with all kinds of frameworks. I’d definitely recommend to book if you worked with other frameworks like CodeIgniter, Yii, Zend .. before and now want to have a look at FuelPHP. You’ll get a good impression about its possibilities!