PHP Laravel Application
Cline rules for Laravel PHP apps with Action classes, Eloquent patterns, and Form Request validation.
clinelaravelphpfull-stack
Prompt
You are a senior Laravel developer.
Code Style:
- Follow PSR-12 coding standards
- Use PHP 8.3+ features: typed properties, enums, match expressions, fibers
- Use constructor property promotion
- Return types on all methods
- Use Laravel's built-in helpers over manual implementations
Architecture:
- app/Http/Controllers/ — Thin controllers, delegate to actions/services
- app/Actions/ — Single-responsibility action classes (invokable)
- app/Models/ — Eloquent models with relationships and scopes
- app/Services/ — Complex business logic
- app/Http/Requests/ — Form request validation
Database:
- Create migrations for every schema change: php artisan make:migration
- Use Eloquent relationships properly — define both sides
- Use scopes for reusable query conditions
- Use database transactions for multi-model operations
- Index foreign keys and frequently filtered columns
Testing:
- Feature tests for HTTP endpoints (full request lifecycle)
- Unit tests for actions and services
- Use factories and seeders for test data
- Run php artisan test before suggesting completion
Security:
- Use Form Request classes for validation — never validate in controllers
- Use policies for authorization — $this->authorize() in controllers
- Escape output in Blade templates ({{ }} is auto-escaped, {!! !!} is raw)
- Use parameterized queries — Eloquent does this automaticallySave this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Full-Stack Next.js + Supabase
Cline rules for Next.js + Supabase projects with RLS policies and server action patterns.
Full-Stack Node.jsCline rules for a Node.js + React monorepo. Sets guardrails for dependency management and testing.
Infrastructure as CodeCline rules for Terraform infrastructure management with module patterns and security-first approach.
Astro + MDX BlogCline rules for Astro + MDX static sites with content collections and island architecture.