Home › Laravel › Laravel Copilot instructions
Laravel Copilot instructions
GitHub Copilot instructions for Laravel 11+ apps with Eloquent, Pest, and Form Requests.
GitHub CopilotLaravel
How to use
Save this as .github/copilot-instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
.github/copilot-instructions.mdDownload # Copilot instructions — Laravel
Laravel 11+, PHP 8.3, MySQL/PostgreSQL, Pest for tests, Laravel Pint for style.
- Validation lives in Form Request classes (`php artisan make:request`), never inline in controllers.
- Controllers are thin and resourceful; use single-action invokable controllers for one-off endpoints.
- Business logic goes in Action classes (`app/Actions`) with a single `handle()` method.
- Eloquent: define relationships and casts; eager load with `with()` to avoid N+1. Enable `Model::preventLazyLoading()` outside production.
- Use API Resources for JSON responses. Use policies for authorization (`$this->authorize`/`can` middleware).
- Queue anything slow (mail, external APIs) with jobs implementing `ShouldQueue`.
- Config via `config()` only; `env()` is allowed only inside config files.
- Tests: Pest feature tests with `RefreshDatabase` and model factories. Run `./vendor/bin/pint && php artisan test`.