Skip to main content

laravel-patterns

Laravel 11+ patterns and conventions. Covers Eloquent, API design, queues, testing, and modern Laravel architecture.

Source facts

Repository
skeletorflet/opencode-kit
Last source activity
March 31, 2026 at 18:16
Detected SKILL.md language
English
Stars
9
Forks
1

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
laravel-patterns
description
Laravel 11+ patterns and conventions. Covers Eloquent, API design, queues, testing, and modern Laravel architecture.
license
MIT
compatibility
opencode
metadata
{"audience":"developers","category":"backend"}
# Laravel Patterns ## What I Do - Build Laravel 11+ applications with modern patterns - Design Eloquent models with proper relationships - Implement API resources and validation - Set up queues and job processing - Write tests with PHPUnit and Pest ## When to Use Me - Creating or extending Laravel applications - Designing Eloquent models and relationships - Building REST APIs with Laravel - Setting up queue workers and scheduled tasks - Writing comprehensive tests ## Key Principles 1. **Form Requests**: Validate in FormRequest classes, not controllers 2. **API Resources**: Transform models with API Resources for responses 3. **Eloquent Events**: Use model events for side effects 4. **Service Container**: Leverage DI and service providers 5. **Queues**: Offload slow operations to queue workers ## Common Patterns ### Form Request ```php class StoreUserRequest extends FormRequest { public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'email', 'unique:users'], 'password' => ['required', 'min:8', 'confirmed'], ]; } } ``` ### API Resource ```php class UserResource extends JsonResource { public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'email' => $this->email, 'created_at' => $this->created_at->toIso8601String(), ]; } } ``` ## Validation ```bash php artisan migrate php artisan test php artisan pint ```
View on GitHub