Skip to main content

Overview

This section covers topics that go beyond the official documentation — areas where you need to read the framework source code to fully understand what’s happening. It also serves as a resource for package authors who want to leverage Laravel’s internal APIs and extension points.

Package Development

Laravel Package Development

A comprehensive guide to developing Laravel packages, covering service providers, publishing config/views/migrations, facades, auto-discovery, and deferred loading.

Testing Laravel packages with Orchestra Testbench

Set up Orchestra Testbench for Laravel package testing and verify service providers, facades, configuration, and database behavior.

Develop Laravel packages with Testbench Workbench

Use Testbench Workbench to build a realistic package development environment with routes, migrations, and a local app runtime.

Package Version Compatibility Management

Practical guide to maintaining package compatibility across Laravel and PHP major versions, including composer.json updates and GitHub Actions test matrices.

GeneratorCommand — Implementing custom make: commands

Extend GeneratorCommand to provide your own make: commands in a Laravel package, covering stubs, namespace control, and testing.

Framework Internals

Application Structure in Laravel 11 and Later

A deep dive into the Slim Application Skeleton, covering Application::configure() through ApplicationBuilder internals.

The Macroable Trait

How to add custom methods to existing Laravel classes using Macroable, without modifying core code.

The Conditionable Trait

How when() and unless() work internally, and patterns for keeping method chains clean with conditional logic.

Illuminate\\Support\\Manager — anatomy of the driver system

The abstract base class behind Laravel’s driver system. Learn to register custom drivers, extend built-in managers, and use MultipleInstanceManager.

The Pipeline Pattern

How Illuminate\Pipeline\Pipeline works, and how to compose multi-step processing chains with the pipeline pattern.

The InteractsWithData trait

Design of InteractsWithData and how to add Laravel-style data access APIs to your own package classes.

tap() Helper and the Tappable Trait

How to use Laravel’s tap() helper and the Tappable trait, including practical implementation patterns.

PHP Attributes

Use PHP attributes introduced and enhanced in Laravel 13 to declare job and model configuration in a more expressive way.

Eloquent Deep Dives

Eloquent Custom Casts

Implement CastsAttributes for custom casts. Covers Value Object casts, inbound-only casts, cast parameters, and the Castable pattern.

Eloquent Observers and Model Events

How Eloquent model events work and how to use Observer classes to handle them centrally. Includes the #[ObservedBy] attribute.

Eloquent Scopes

How local and global scopes work, with a look at SoftDeletingScope internals and practical patterns for multi-tenancy and publish/draft filtering.

Collection Deep Dive

Laravel Collection internals: historical evolution, class structure, PHPDoc generics, and a practical source-reading path.

Higher Order Messages

How HigherOrderCollectionProxy enables the $collection->map->method() syntax, and practical patterns for Eloquent collections.

MCP & AI

Building an MCP Server with Laravel

Build a production-ready MCP server using the laravel/mcp package. Covers tools, resources, prompts, authentication, testing, and deployment.

Creating a Custom Provider for AI SDK

Understand the Laravel AI SDK source code and implement custom providers for AI services not supported out of the box.

Creating a Custom Agent for Boost

Deep dive into Laravel Boost’s extension architecture and implement custom agents using the SupportsGuidelines, SupportsMcp, and SupportsSkills contracts.

Auth, Validation & More

Custom Authentication Guards

Implement the Guard and StatefulGuard interfaces to build custom authentication guards, from API token auth to multi-guard applications.

Custom Validation Rules

Extend Laravel’s validation with rule objects and closures, from basic implementations to advanced data-aware and validator-aware rules.

Rate Limiting

Configure custom rate limiters with the RateLimiter facade, apply them to routes, and handle high-traffic scenarios with Redis-backed limiting.

Advanced Testing with Pest

Master Pest: the Expectation API, datasets, mocking, HTTP fakes, and architecture tests for well-structured codebases.
最終更新日 2026年5月1日