Matt Stauffer who has been blogging about Laravel since the 5.0 release, the host of the Laravel Podcast, and partner and technical director at Tighten.co has been working on a new Laravel book, Laravel: Up & Running, published by O’Reilly.
Here are a few of the topics this book covers:
- Blade, Laravel’s powerful custom templating tool
- Tools for gathering, validating, normalizing, and filtering user-provided data
- Laravel’s Eloquent ORM for working with the application’s databases
- The Illuminate request object, and its role in the application lifecycle
- PHPUnit, Mockery, and PHPSpec for testing your PHP code
- Laravel’s tools for writing JSON and RESTful APIs
- Interfaces for file system access, sessions, cookies, caches, and search
- Tools for implementing queues, jobs, events, and WebSocket event publishing
- Laravel’s specialty packages: Scout, Passport, Cashier, Echo, Elixir, Valet, and Socialite
With the book now complete and heading off into printing I had the opportunity to ask Matt a few questions about the book and his experiences as a first-time author.
How excited are you now that the book is complete and ready to start shipping?
Eric. My friend. I started writing this book in July of 2015. I wrote the last chapter (other than Laravel 5.3 additions) in May 2016. I updated the Laravel 5.3 sections in August. I’ve spent the last three and half months going back and forth with O’Reilly on edits and reviews and indexes and draft covers.
I’m not saying I’m more excited about this book releasing than I was about the birth of my children. But. It does sort of feel like my baby. And I cried like a little child when each of my kids came into the world.
So, to answer your question, I’m excited.
What initially inspired you to want to write a book on Laravel?
I’d tossed around the idea of writing a book for a while. To be honest, I was more strongly considering a softer skills book. But then O’Reilly approached me about writing a book about Laravel, and it was obvious instantly how great this could be.
There are a few things that have inspired me in this process. One is how much I love teaching. I love it. I love blogging and mentoring and speaking at conferences. So this book is basically just the permission for me to do that for 440 pages. It’s incredible. It’s a rush, to imagine that someone will pick up this book not knowing Laravel and finish it able to write significant applications. I get to help with that.
I’m also incredibly excited to see Laravel move into more spaces. O’Reilly has access to academia and tons of enterprise settings that will help Laravel move into those spaces.
And finally, I love the idea of having a single resource to point people toward for starting their journey as a Laravel developer. I love telling people to subscribe to Laravel news and sign up for Laracasts for their ongoing education, but now I’ll have something to point them to as the place to get started.
Did you have a certain audience in mind while you were writing it?
I have two audiences in mind. First, the primary audience is a PHP developer who’s never worked in Laravel before, or just gotten started. The book starts at the tools you need on every site and expands from there; that means many readers will break off after the first or second or third chapters and get started coding, and return back to the book as their needs grow.
The book doesn’t expect you to have any knowledge of Laravel or how it works, which is why it’s great for a developer new to Laravel.
However, I had a secondary goal. As I wrote the book, I learned a ton about Laravel, and I realized that I could write the book in a way that would also provide benefit to the most experienced of Laravel developers. So I set out to write it in a way that exposed some little secrets of the code base, explaining how things work that so many of us just expect to “just work.”
Writing a book on a framework means you have to dig deep into the code, did you learn a lot of new things about Laravel?
I couldn’t even begin to list off the things I learned while writing the book. I read through every single line of the Laravel / Illuminate codebases many times writing the book, and followed all sorts of logic and dependency chains up and down. It was fascinating, and I think it really impacted how I code.
I wrote up a few fun things I learned in a post on my blog title Things I didn’t know Laravel could do. But that’s just the tip of the iceberg. It’s absolutely incredible how much you learn.
The parts of the book that made me move the slowest were the features I don’t use day-to-day. When’s the last time you wrote a many-to-many polymorphic relationship? I can’t tell you the last time I did. But in order to write this book with integrity, I had to become an expert on it–which meant not only reading the docs and the source, but also spinning up sample apps using each feature to make sure it worked the way I expected, and to make sure I caught any gotchas. It was intense, but yes: I learned a ton.
When you started writing did you expect it to take as long as did?
Our original plan was for it to take nine months. They wanted me to say six, but I knew my life was busy and shot for nine.
There are a few reasons it took so much longer. First, it was just a lot harder to find long uninterrupted blocks of time to write than I had ever expected. Second, what was intended to be a 250-page book turned out to be a 440-page book. The length is just right, so I’m glad it ended up as it did, but that definitely left it taking longer than I originally expected. And third, we planned the final delivery of the book around the release of Laravel 5.3, so when that came out a few months later than I expected, that meant the book had to come out a few months later as well.
What tools and apps did you use to create the book with?
O’Reilly uses an internal system called Atlas, which means I used AsciiDoc (a cousin of Markdown) and Git.
I wrote the entire book in Sublime Text, in AsciiDoc, versioned with Git. I pushed up to their servers and clicked a button on their site and waited for a few minutes every time I needed a PDF preview.
I created a few graphics in PhotoShop, but thankfully their editors fixed those up for me.
What was the hardest part of writing the book?
The hardest part of writing the book was working through sections that are dense–for example, the initial DB and Eloquent spec require you to cover an incredible amount of methods, one after another–without being boring and without just mirroring the docs.
Some sections were so easy–when there’s a lot of thinking and architecture and when I work with it every day. The section on the container is one of my favorites in the book, and it just flowed out without hardly any work. Not every section was like this.
If you started a new book today, what would you do differently?
If I started this same book again today, I can’t say I would do much differently. I’m very happy with how it turned out. Maybe I would time all the time I spent writing it so I had a really good understanding of how many hours I actually put into it.[a]
If I started a new book today, I’d self-publish. Not because that’s better, but because I’ve gone the traditional publisher route. I want to do it myself next time around. Write the book, publish it, send it out, collect my own payments, handle my own everything, release my own book with my own typos. Again–not because I didn’t enjoy this. But because I want something different.
Why should people buy Laravel Up & Running?
There are a few reasons people should buy Laravel: Up & Running. First, it’s the clearest and most comprehensive book about Laravel in existence. If you want to learn Laravel, this will absolutely be the best way to learn it, from scratch, as quickly as possible.
Second, I poured my heart into this. I’ve definitely let the blog slack a little bit–I’m very sad about this, and really hope to remedy that as quickly as possible. If you like my blog or my podcasts, a lot of that energy has gone into this book. I’ve worked hard to make it as valuable as possible.
Third, it has a gemsbok on the cover. A gemsbok. Do you know what a gemsbok is? I didn’t know what a gemsbok is. It’s fascinating. Don’t you now want a book with a gemsbok on the cover? I thought so. Boom. There you go.
Filed in: Laravel Books
Join the weekly newsletter and never miss out on new tips, tutorials, and more.
- Software Engineer Lead (PHP)
- Full-time Senior Web Developer
Wayne State University
- Senior Software Engineer
- Full Stack Engineer
Remote or Medford, Oregon
- Laravel Developer (fulltime - Dutch only)
Qbixx | Webservices
- Full Stack or Back-End Developer
Alexandria, VA; Tallahassee, FL; Orlando, FL
Marketing for Change
- Senior Quality Assurance Engineer
Store your translations in the database with Laravel translation loader package
Laravel has built-in support for localization using arrays stored in language files and in 5.4 they are adding the ab…
Getting started with Watson Personality Insights
One of the most important things as a business owner is being able to understand your customers’ needs and want…