Introduction
At the tail end of October last year I saw a post on LinkedIn by Packt asking if anyone would like a free copy of their recently published Laravel Application Development Cookbook by Terry Matula. Being the greedy so-and-so that I am, I jumped at the chance to get something for free – the fact it was a book about Laravel, a framework which is currently in the centre of my latest project, made it all the sweeter. Of course, there is no such thing as a free lunch, and in exchange for the aforementioned free copy of the book, I had to write a review of it, which is what you’re reading right now.
I should mention at this point that I’ve only read the first three chapters, so there might be a second or even third part to this review published at some point in the future, but I feel that I’ve read enough (and seen enough warning signs in the way that the book is written) to give my opinion on what I have read thus far.
Laravel
Laravel, for anyone that doesn’t know, is a PHP framework developed by Taylor Otwell and popularized by Jeffrey Way (at least, it’s because of Jeffrey Way that I know about it). Taking advantage of the latest features available in PHP’s arsenal, not least of which being Composer, a dependency manager which takes the hard work out of using third-party classes, Laravel is at the cutting edge of what PHP can do.
One of the things that I like about Laravel is that anyone with experience writing PHP can pick it up and use it with ease. That’s not to say there isn’t anything to learn about the framework (there is a hell of a lot), rather, whereas Frameworks like CakePHP and Yii have their own, propriety and overly complicated ways of going about thing such as using modules/addons/packages/classes, the PSR standards which Laravel adopts (thanks, in part, to Composer) are super simple. Combine that with a whole host of cool ideas and features, and you’ve got yourself a fantastic little framework.
The Book
Unfortunately, while I would love to sing this book’s praises, I found too many examples of sloppy code and poor explanation within the first three chapters to do this.
An example of this, early in the first chapter, is the task titled “Installing Laravel as a git submodule”. While I can’t fault the method presented within the book for achieving this, I’m a little confused as to why this task even exists, as frankly, it’s just a bad idea. The Laravel framework itself is a Composer package, and is both installed and autoloaded via it, so to ignore this system in favour of a git-based one, which would make updating it much more of a chore, just doesn’t make sense. If this book was for a framework like Yii, then it would be a perfect fit, and I’d be applauding it for including it, but here, it just leaves me with the impression that the author doesn’t understand Laravel.
The next task, designed to help you set-up a working server environment, is no better. Here the author knows that PHP has a built-in server, but rather than teach you how to use it, instead focuses on setting up a full stack environment. OK, so I don’t really have a problem with this in itself, but I do have a problem with the approach he takes, specifically that of recommending wampserver. For what it’s worth, as a Windows user, I like wampserver, and have been known to use it from time to time. The problem with wampserver is that it only works on Windows, and the author fails to provide Mac or Linux users with any useful information on how to do the same on their respective platforms.
The other problem I have with this approach is that a better alternative exists, that of Vagrant, a cross-platform solution that makes it easy to create virtual machines running whatever server software you need. You don’t even need to worry about learning how to configure Vagrant or the virtual machines it hosts, as tools such as puphpet, or pre-configured systems like Laravel4-Vagrant make it easy.
The next few tasks and following chapter were better, with some useful information, although none of it was ground-breaking, and most of it I already knew from other sources. I was disappointed that none of the examples I’ve read so far included anything about Blade (Laravel’s template system), although this could have been to try and keep examples simple (not that Blade is complicated).
Conclusion
Now maybe I’m being unfair in this, seeing as I have only read about a quarter of the book, but based on what I have read, I’m not filled with confidence in the quality of what lies ahead, (this is partly why I have only read three chapters). It is for this reason which I’m finding it difficult to recommend this book. I do plan on finishing it, as it will no doubt have some useful information, and parts two and three of this review (if they ever get written) might contradict this opinion, but until that happens, I’d say borrow the book from a friend rather than pay for it yourself.
In the meantime, if you’re looking for a good way of learning Laravel, you can’t go wrong with Laracasts.