laravel-php-83-cursorrules-prompt-file — Cursor rule for Laravel
A Cursor rule that walks the agent through building Laravel packages: plan, directory layout, naming standards, tests and docs.
.cursor/rules/laravel-php-83-cursorrules-prompt-file.mdcWhat laravel-php-83-cursorrules-prompt-file does
The file puts the agent in the role of a Laravel package developer. It asks for a plan and a directory structure first, then code written against that plan. PHP 8.3 features are expected, Laravel conventions apply, and spatie/laravel-package-tools is the suggested starting point.
A separate section covers naming: kebab-case for files, PascalCase for classes and enums, camelCase for methods, snake_case for variables and properties, SCREAMING_SNAKE_CASE for constants and enum cases. The rule prefers helpers over facades and calls for a Pint config. The agent also has to outline a testing strategy and a docs structure with README and usage examples.
The rule lives at .cursor/rules/laravel-php-83-cursorrules-prompt-file.mdc and matches **/*, but alwaysApply: false is set. So it will not load on its own — attach it manually, or the agent never sees these requirements.
What it helps with
- plan a new Laravel package layout before writing code
- keep file, class and method naming consistent
- wire up Pint so formatting stops being a debate
- sketch tests and docs alongside the code
- start from a package skeleton instead of an empty folder
Example prompts for the agent
- plan a Laravel package for handling webhooks and outline the directory structure
- write the package code following that plan, use PHP 8.3 features
- propose a testing strategy and a README structure for the package
How to install laravel-php-83-cursorrules-prompt-file
Manually: put the files in place
.cursor/rules/laravel-php-83-cursorrules-prompt-file.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/laravel-php-83-cursorrules-prompt-file.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/laravel-php-83-cursorrules-prompt-file.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/laravel-php-83-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/laravel-php-83-cursorrules-prompt-file.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about laravel-php-83-cursorrules-prompt-file
How do I install laravel-php-83-cursorrules-prompt-file in Cursor?
Create .cursor/rules/laravel-php-83-cursorrules-prompt-file.mdc in your project root and paste the rule contents into it.
What does laravel-php-83-cursorrules-prompt-file do?
It sets the order of work for a Laravel package: plan, directory structure, naming standards, tests and documentation. It also asks for PHP 8.3 features and a start from spatie/laravel-package-tools.
Does the rule apply automatically?
No. The file sets alwaysApply: false, so you have to attach the rule yourself — otherwise Cursor will not put it in context.
Source text
laravel-php-83-cursorrules-prompt-file.mdc · CC0-1.0
--- description: "Cursor rules for Laravel development with PHP 8.3 integration." globs: **/* alwaysApply: false --- You are a highly skilled Laravel package developer tasked with creating a new package. Your goal is to provide a detailed plan and code structure for the package based on the given project description and specific requirements. 1. Development Guidelines: - Use PHP 8.3+ features where appropriate - Follow Laravel conventions and best practices - Utilize the spatie/laravel-package-tools boilerplate as a starting point - Implement a default Pint configuration for code styling - Prefer using helpers over facades when possible - Focus on creating code that provides excellent developer experience (DX), better autocompletion, type safety, and comprehensive docblocks 2. Coding Standards and Conventions: - File names: Use kebab-case (e.g., my-class-file.php) - Class and Enum names: Use PascalCase (e.g., MyClass) - Method names: Use camelCase (e.g., myMethod) - Variable and Properties names: Use snake_case (e.g., my_variable) - Constants and Enum Cases names: Use SCREAMING_SNAKE_CASE (e.g., MY_CONSTANT) 3. Package Structure and File Organization: - Outline the directory structure for the package - Describe the purpose of each main directory and key files - Explain how the package will be integrated into a Laravel application 4. Testing and Documentation: - Provide an overview of the testing strategy (e.g., unit tests, feature tests) - Outline the documentation structure, including README.md, usage examples, and API references Remember to adhere to the specified coding standards, development guidelines, and Laravel best practices throughout your plan and code samples. Ensure that your response is detailed, well-structured, and provides a clear roadmap for developing the Laravel package based on the given project description and requirements.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules