Builder: Separate the construction of a complex object from its representation, allowing the same process to create different types. The Builder pattern constructs a complex object step by step. Instead of one constructor with twelve parameters, you call clear methods one at a time and finish with build(). Code like Query::table('orders')->where('status', 'paid')->orderBy('created_at')->get() is a builder. Each step reads like a sentence, optional parts can be left out, and the final call creates the result.
Builders shine when objects have many optional settings, such as emails, HTTP requests, reports or test data. Laravel's query builder and model factories are everyday examples. For simple objects with two or three required values, a normal constructor is clearer. A builder adds a class, so use it where the readability gain is real.
Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.