Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Matt Stauffer

Rating No ratings yet

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 • Blade, Laravel's powerful custom templating tool • Tools for gathering, validating, normalizing, and filtering user-provided data • The Eloquent ORM for working with application databases • The Illuminate request object and its role in the application lifecycle • PHPUnit, Mockery, and Dusk for testing your PHP code • Tools for writing JSON and RESTful APIs • Interfaces for filesystem access, sessions, cookies, caches, and search • Tools for implementing queues, jobs, events, and WebSocket event publishing • Specialty packages including Scout, Passport, Cashier, and more

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, example-driven tour of Laravel 10 for experienced PHP developers who want to build modern web apps quickly with clean, readable code. If you already know PHP and want a fast on-ramp to Laravel's routing, Blade, Eloquent, testing, and API tooling, this is your guide. 【Book Arc】 - **Opening (~0%–10%)**: Orients you to what Laravel is and why it exists, tracing its history from early versions through Laravel 4's Composer-based rewrite, and previews the framework's core feature set. - **Early (~10%–35%)**: Gets you running — local development environments (Valet, Herd, Homestead), then the fundamentals of routing, controllers, MVC, HTTP verbs, and Blade templating with its directives and inheritance model. - **Middle (~35%–55%)**: Moves into data — database migrations, the query builder's fluent interface, and the Eloquent ORM for creating, updating, and relating records. - **Late (~55%–80%)**: Covers the request lifecycle and user-provided data: the Illuminate request object, validation rules, custom rule objects, and error handling. (Excerpts do not cover the exact boundaries of this stage.) - **Ending (~80%–100%)**: The book's back matter promises testing (PHPUnit, Mockery, Dusk), API tooling, filesystem/session/cache interfaces, queues and events, and specialty packages like Scout, Passport, and Cashier — though excerpts do not cover these chapters in detail. 【Key Takeaways】 - **Laravel's value proposition is speed and simplicity** (Opening): a rapid application development framework with an ecosystem of first-party tools that lets you build sites with clean, readable code — the central thesis the whole book demonstrates. - **Routing is the first and most important thing to learn** (Early): without routes you have no way to interact with users; the book treats route definition, naming conventions, and HTTP verb handling as foundational. - **Blade trades raw PHP for expressive, extensible templating** (Early): curly-brace echoing, @-prefixed directives, inheritance, and custom directives let you hide complex or repetitive PHP behind clean syntax. - **The query builder offers a fluent, database-agnostic interface** (Middle): one API connects to MySQL, PostgreSQL, SQLite, and SQL Server, with method chaining, joins, unions, and raw-query escape hatches. - **Eloquent separates building a record from persisting it** (Middle): make() creates an unsaved instance while create() saves immediately — and mass assignment rules govern which attributes can be set via arrays. - **Migrations make schema changes versioned and reversible** (Middle): up() and down() methods define forward and rollback behavior, with Artisan commands for inspecting database state. - **Validation is a first-class concern for user-provided data** (Late): the request object supports validate(), manual validation, custom rule objects, and clear error message display. - **Custom Blade directives shine for repeated logic, not simple expansion** (Early): for trivial code shortcuts, prefer view partials; reserve directives for simplifying recurring conditional patterns. 【Reading Tips】 - **Skim the history and environment setup** (Opening–Early) if you already have a working PHP dev environment; the Valet/Herd/Homestead comparison is useful reference but not deep reading. - **Deep-read routing, Blade, and Eloquent** (Early–Middle) — these are the chapters with the most concrete, transferable patterns and the highest day-to-day payoff. - **Watch the make() vs. create() distinction and mass assignment** (Middle): this is a common source of confusion and bugs for newcomers to Eloquent. - **Treat the back-matter chapters as a menu** (Ending): testing, APIs, queues, and specialty packages are each large topics; read the ones relevant to your project rather than front-to-back. - **Keep the book open alongside a real project**: the examples are designed to be adapted, not just read. 【Coverage Limits】 This guide is synthesized from stratified excerpts covering roughly the first half of the book (through Eloquent and validation). The later chapters on testing, APIs, queues, events, and specialty packages are named in the table of contents but not covered in the excerpts, so their treatment here is necessarily thin.
Excerpt 1
174 Pagination 175 Paginating Database Results 175 Manually Creating Paginators 177 Message Bags 178 String Helpers, Pluralization, and Localization 179 The...
View in text
Excerpt 2
most important project to tackle when learning a web frame‐ work; without routes, you have little to no ability to interact with the end user. In this chapte...
View in text
Excerpt 3
lement in the $modules array) will be passed as to the view. And the optional fourth parameter is the view to show if the array or collection is empty (or, o...
View in text
Excerpt 4
ns one after another, or use leftJoin() to get a left join. Finally, you can create more complex joins by passing a closure into the join() method: DB::table...
View in text
Excerpt 5
-PHP assets, and several starter kits. Laravel Starter Kits Out of the box, Laravel provides an entire build system, which we’ll cover shortly, but it also i...
View in text
Excerpt 6
e a few more, which you’ll learn about in Chapter 16. route If you run route:list, you’ll see the definitions of every route defined in the application, incl...
View in text
Excerpt 7
10-1. Deferring the registration of a service provider use Illuminate\Contracts\Support\DeferrableProvider; class GitHubServiceProvider extends ServiceProvid...
View in text
Excerpt 8
interfaces when you need them rebound, directly in the test. Example 11-17 shows how. Example 11-17. Overriding a binding in tests public function test_it_do...
View in text
Tags
AI categories
Programming LanguagePhpWeb Technology
Publisher: O'Reilly Media
Publish Year: 2023
Language: English
Pages: 562
File Format: PDF
File Size: 3.9 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…