Architecture
Architecture (source: Pexels vis Pixabay).

I recently asked Matt Stauffer, Partner and Technical Director at Tighten Co. to discuss his work with the Laravel community, including what makes the PHP framework great for rapid application development and how it interoperates with new and emerging frontend tooling. Matt is also the author of Laravel: Up and Running, which O'Reilly published in November 2016.

Why is Laravel described as a framework for “web artisans”?

I think the goal is to evoke the idea of someone who cares deeply about their process and the quality of what they deliver. I’ve always imagined someone laboring over a wooden chair in a back workshop, paying close attention to every detail—even those which no one will ever see. It might be a good contrast to set a Walmart chair, mass produced in a factory by machines from a template, to a hand-carved one-of-a-kind Amish chair.

There are a few reason this relates to Laravel. First, Taylor Otwell (creator of Laravel) is the sort to painstakingly finesse the interface Laravel presents to developers, re-working the API of a feature over and over until it feels right. This even extends to the code style, which has led to useful features like short and readable method signatures and also some things that are just fun like Laravel’s unique alignment of comment blocks. And second, as a rapid application development framework, Laravel hides a lot of the repetitive—and therefore un-inspiring—aspects of application development, leaving time and space for developers to focus on creating expressive, well-crafted applications.

You’ve given some talks on leveraging Laravel for side projects—what about the framework makes it such a good fit for prototyping?

As a rapid application development framework, Laravel comes out of the box with a series of opinionated defaults. Like Rails and other “opinionated” web frameworks, Laravel subscribes to the idea of “convention over configuration.” This means that, where another framework might pride itself in making zero assumptions about your application before you write any code—leaving you to configure everything again and again with each new application—Laravel and frameworks like it provide conventions of how everything will be configured.

These conventions can be anything from file and folder paths to the naming relationship between a model and its backing tables and pivot tables. Each convention is another decision that I don’t have to make every time I build a new app with Laravel, which leaves more and more of my time and attention to working on what is unique in this specific app. That’s why it’s great for prototyping: out of the box it already handles my database access, authentication, authorization, basic RESTful APIs with pagination, and so much more. In a few hours I can build a fully functional SaaS and launch it (using Laravel’s Forge, of course) on DigitalOcean.

What recent or coming Laravel features are you most excited about?

I’m most excited about the ways Laravel 5.3 expanded Laravel’s capacity for interacting with Websocket servers like Pusher. Laravel’s new tool Echo makes it unbelievably simple to push simple messages and complex data structures to your end users in near-realtime, and with SPAs or even simple on-page JavaScript components, this makes it simple to significantly increase the perceived speed and interactivity of your applications.

For developers looking to go more “full-stack,” what frontend tools and frameworks do you find work best with Laravel?

Out of the box, Laravel instantly connects with gulp, webpack, and VueJS. The Laravel and VueJS communities have a ton of overlap, and Evan You (the creator of Vue) spoke at Laracon this past year. So if you want the closest relationship, definitely go there.

At Tighten we’ve done quite a bit of work with React and Laravel, and they definitely play together very nicely. Of course, you can always write vanilla ES5 or ES6 JavaScript and Laravel’s gulp wrapper Elixir will process and concatenate and minify it for you. And one of the things that’s the best about Laravel is that, while it has opinionated defaults, they’re very easy to overwrite. It’s a matter of a few seconds of work to delete the out-of-the-box Vue components and drop in whichever frontend tooling you prefer.

As for non-JavaScript frontend components, Less and Sass are both equally easy to work with, and the default auth views that Laravel provides come with Bootstrap classes, so that’s easy to get started with as well.

Web development—with the wide range of backend and frontend languages, frameworks, and all of the tools and dependencies developers deal with on a day-to-day basis building apps and sites—is inherently complex. What advice do you give folks who are just starting out in web development?

When someone is getting started in web development, I usually focus on three things. First, you have to learn your foundations. Get good at HTML, responsive CSS3, and vanilla JavaScript. This will be of use to you no matter where you’re working.

Second, pick something and get good at it. Pick a single frontend framework and a single backend framework and get to know them well. Try a variety of projects in them; find the places they annoy you; get to know the communities; dig in deep; give back.

Finally, go learn other things. Learn another language or framework; learn to develop something outside of the web. The more languages you know, the more frameworks you’ve tried, the more you are exposed to different ways of thinking about programming, the better you’ll work in whatever language and framework you’re in at the moment. Some of the core values that Laravel provides come from .NET MVC and Sinatra. Some of my best thinking about rapid application development comes from my connections to the Rails community. Every community has something to learn from those around us.

Article image: Architecture (source: Pexels vis Pixabay).