Laravel + PHP Rules
Laravel PHP framework with Eloquent and Blade
# Role You are an expert Laravel developer following Laravel conventions and best practices. # Tech Stack - PHP 8.3+ - Laravel 11 - Eloquent ORM - Blade Templates - Livewire # Code Conventions - Follow Laravel naming conventions: PascalCase models, snake_case DB columns. - Use Eloquent ORM for all database operations. - Use form requests for validation logic. - Use resource controllers for REST endpoints. - Use Laravel's built-in authentication scaffolding. - Use service classes for complex business logic. - Use Laravel queues for background jobs. - Use Blade components for reusable UI elements. - Use migrations and seeders for database management. # Code Style Preferences - Use TypeScript strict mode. Define types for all variables, parameters, and return values. - Never use the `any` type. Use `unknown` if the type is truly uncertain, then narrow it. - Use `const` by default. Only use `let` when reassignment is needed. Never use `var`. - Always handle errors explicitly. Use try/catch for async operations. Never silently swallow errors. - Use early returns (guard clauses) to reduce nesting and improve readability. - Use descriptive, meaningful names for variables, functions, and classes. Avoid abbreviations. - Keep functions small and focused. Each function should do one thing. Aim for under 50 lines. # What to Avoid - Do not write raw SQL queries — use Eloquent or Query Builder. - Do not put business logic in controllers — use services. - Do not use `env()` outside of config files. - Do not skip validation — always use form requests.
About Laravel + PHP AI Rules
AI coding rules files help your AI assistant (Cursor, Windsurf, Claude Code, GitHub Copilot, or Cline) understand your project's conventions, tech stack, and coding standards. This ensures the AI generates code that matches your team's style and follows best practices for Laravel.
This preset is designed for Laravel + PHP projects and includes rules for:
- Follow Laravel naming conventions: PascalCase models, snake_case DB columns.
- Use Eloquent ORM for all database operations.
- Use form requests for validation logic.
- Use resource controllers for REST endpoints.
- Use Laravel's built-in authentication scaffolding.
Simply select your preferred AI IDE format above, then copy or download the generated rules file. Place it in your project's root directory and your AI assistant will automatically follow these conventions.
Get This Preset for a Specific IDE
Cursor
Laravel + PHP rules for Cursor
Windsurf
Laravel + PHP rules for Windsurf
Claude Code
Laravel + PHP rules for Claude Code
GitHub Copilot
Laravel + PHP rules for GitHub Copilot
Cline
Laravel + PHP rules for Cline
Zed AI
Laravel + PHP rules for Zed AI
Aider
Laravel + PHP rules for Aider
Continue.dev
Laravel + PHP rules for Continue.dev
Devin AI
Laravel + PHP rules for Devin AI
Amazon Q
Laravel + PHP rules for Amazon Q
Bolt.new
Laravel + PHP rules for Bolt.new
Lovable
Laravel + PHP rules for Lovable
Replit AI
Laravel + PHP rules for Replit AI
Augment Code
Laravel + PHP rules for Augment Code
JetBrains AI
Laravel + PHP rules for JetBrains AI