A Framework for Building Modern PHP Apps
Matt Stauffer
Laravel#
Framework#
PHP#
JSON#
RESTful_APIs#
ORM#
What sets Laravel apart from other PHP web frameworks? Speed and simplicity, for starters. This rapid application development framework and its ecosystem of tools let you quickly build new sites and applications with clean, readable code. Fully updated to include Laravel 10, the third edition of this practical guide provides the definitive introduction to one of today's most popular web frameworks.
Matt Stauffer, a leading teacher and developer in the Laravel community, delivers a high-level overview and concrete examples to help experienced PHP web developers get started with this framework right away. This updated edition covers the entirely new auth and frontend tooling and other first-party tools introduced since the second edition.
Dive into features, including:
Table of Contents
Chapter 1. Why Laravel?
Chapter 2. Setting Up a Laravel Development Environment
Chapter 3. Routing and Controllers
Chapter 4. Blade Templating
Chapter 5. Databases and Eloquent
Chapter 6. Frontend Components
Chapter 7. Collecting and Handling User Data
Chapter 8. Artisan and Tinker
Chapter 9. User Authentication and Authorization
Chapter 10. Requests, Responses, and Middleware
Chapter 11. The Container
Chapter 12. Testing
Chapter 13. Writing APIs
Chapter 14. Storage and Retrieval
Chapter 15. Mail and Notifications
Chapter 16. Queues, Jobs, Events, Broadcasting, and the Scheduler
Chapter 17. Helpers and Collections
Chapter 18. The Laravel Ecosystem
Who This Book Is For
This book assumes knowledge of basic object-oriented programming practices, PHP (or at least the general syntax of C-family languages), and the basic concepts of the Model–View–Controller (MVC) pattern and templating. If you’ve never made a website before, you may find yourself in over your head. But as long as you have some programming experience, you don’t have to know anything about Laravel before you read this book—we’ll cover everything you need to know, from the simplest “Hello, world!”
Laravel can run on any operating system, but there will be some bash (shell) commands in the book that are easiest to run on Linux/macOS. Windows users may have a harder time with these commands and with modern PHP development, but if you follow the instructions to get Homestead (a Linux virtual machine) running, you’ll be able to run all of the commands from there.
How This Book Is Structured
This book is structured in what I imagine to be a chronological order: if you’re building your first web app with Laravel, the early chapters cover the foundational components you’ll need to get started, and the later chapters cover less foundational or more esoteric features.
Each section of the book can be read on its own, but for someone new to the framework, I’ve tried to structure the chapters so that it’s actually very reasonable to start from the beginning and read until the end.
Where applicable, each chapter will end with two sections: “Testing” and “TL;DR.” If you’re not familiar, “TL;DR” means “too long; didn’t read.” These final sections will show you how to write tests for the features covered in each chapter and will give a high-level overview of what was covered.
The book is written for Laravel 10.
Matt Stauffer is co-founder, COO, and CTO at Tighten Co., a leading Laravel development shop; host of the Laravel Podcast; and a frequent speaker at Laravel conferences and events. He's been teaching about Laravel through blogs, podcasts, conference talks, and client consulting since the earliest days of Laravel.