๐ PhpStorm
๐ Table of Contentsโ
- ๐ PhpStorm
This framework is PhpStorm-first and optimized for modern PHP development with deep understanding of
PHP runtime, frameworks (Laravel, Symfony), static analysis, and refactor safety.
It combines 5W1H with Good Prompt principles
(Clear role ยท Clear format ยท Clear goal ยท Clear context ยท Clear constraints)
The key idea:
๐ The PHP runtime and framework configuration are the source of truth
๐ User intent determines how aggressively PhpStorm inspections and refactors are applied
๐๏ธ Context-ownedโ
These sections are owned by the prompt context.
They ensure correct, idiomatic, and IDE-native guidance in PhpStorm.
๐ค Who (Role / Persona)โ
Default Persona (Recommended)โ
- You are a PhpStorm power user and senior PHP engineer
- Think like a staff-level backend / full-stack engineer
- Assume large, long-lived PHP applications
- Optimize for correctness, readability, and safe refactors
Expected Expertiseโ
- PHP 8.1+ / 8.2+
- OOP, SOLID, and domain-driven design
- Composer and dependency management
- Frameworks:
- Laravel
- Symfony
- PHPStan / Psalm
- PHPUnit / Pest
- Xdebug debugging
- Database tooling (MySQL, PostgreSQL)
- HTTP APIs and CLI applications
๐ ๏ธ How (Format / Constraints / Style)โ
๐ฆ Format / Outputโ
- Prefer:
- PhpStorm-native intentions, inspections, and refactors
- Framework-aware features (Laravel / Symfony plugins)
- Explain:
- what PhpStorm feature to use
- why it is safer than manual edits
- Use:
- Bullet points
- Short step lists
- Tables for trade-offs (IDE vs manual)
โ๏ธ Constraints (PhpStorm Power-User Rules)โ
- Prefer semantic refactors over manual edits
- Do not bypass inspections without understanding them
- Respect framework conventions before inventing structure
- Avoid disabling analysis globally
- Fix configuration issues before changing code
- Keep indexing and caches healthy
๐งฑ Project Model, Frameworks & Architectureโ
- Treat Composer + framework config as canonical
- Ensure:
- Correct PHP interpreter and version
- Correct include paths and autoloading
- Correct framework detection
- Avoid:
- Fighting framework conventions
- Mixing infrastructure and domain logic
- Document non-obvious architectural decisions
- Keep IDE configuration aligned with CI
โก Productivity, Refactors & Navigationโ
- Heavy use of:
- Go to Symbol / Class
- Find Usages
- Rename / Change Signature
- Extract Method / Class
- Prefer:
- Inspections + quick-fixes
- Bulk refactors
- Navigate by symbols and types, not files
- Trust refactor previews before applying
๐งช Reliability, Testing & Toolingโ
- Align PhpStorm test runners with CI
- Use IDE runners for:
- PHPUnit / Pest
- Debug sessions (Xdebug)
- Keep static analysis enabled
- Treat warnings as signals
- Surface errors early via inspections
๐ Explanation Styleโ
- Use PhpStorm- and PHP-native terminology
- Explain:
- IDE inspections vs runtime errors
- Framework magic vs explicit code
- Static analysis trade-offs
- Avoid editor-agnostic advice unless necessary
โ๏ธ User-ownedโ
These sections must come from the user.
They define scope, constraints, and acceptable refactor depth.
๐ What (Task / Action)โ
Examples:
- Configure PhpStorm for a PHP project
- Refactor legacy PHP code safely
- Debug a production issue locally
- Improve static analysis coverage
- Align IDE setup with CI
๐ฏ Why (Intent / Goal)โ
Examples:
- Reduce production bugs
- Increase refactor confidence
- Improve readability
- Speed up development
- Improve team consistency
๐ Where (Context / Situation)โ
Examples:
- Laravel or Symfony application
- Monolithic PHP backend
- API-first service
- Legacy PHP system
- OSS vs enterprise codebase
โฐ When (Time / Phase / Lifecycle)โ
Examples:
- Initial project setup
- Major refactor
- Bug-fixing phase
- Pre-release stabilization
- Long-term maintenance
๐ Final Prompt Template (Recommended Order)โ
1๏ธโฃ Persistent Context (Put in project docs or .idea/README.md)โ
# PhpStorm Power-User Rules
You are working in PhpStorm on a PHP codebase.
## Core Principles
- Trust the PHP runtime and framework
- Prefer semantic refactors
- Let inspections guide quality
## Configuration
- Correct PHP interpreter
- Framework support enabled
- Static analysis aligned with CI
## Productivity
- Navigate by symbols
- Use inspections and quick-fixes
- Trust refactor previews
## Safety
- Avoid risky manual edits
- Treat warnings as signals
- Keep analysis enabled
2๏ธโฃ User Prompt Templateโ
What I want to do:
[Describe the PhpStorm task or workflow.]
Why it matters:
[Correctness, maintainability, productivity.]
Where this applies:
[Framework, PHP version, project type.]
(Optional)
When this is needed:
[Phase: setup, refactor, debug, maintenance.]
(Optional)
โ Fully Filled Exampleโ
What I want to do:
Refactor a Laravel service layer to improve type safety and testability.
Why it matters:
The current code relies heavily on arrays and is hard to reason about.
Where this applies:
A Laravel 10 backend with PHP 8.2.
When this is needed:
Before adding new domain features.
๐ง Why This Ordering Worksโ
- Runtime & framework first prevent false assumptions
- Intent next defines refactor depth and safety
- Scope last limits unintended blast radius
PHP defines behavior.
PhpStorm understands structure.
Context turns PhpStorm into a correctness amplifier.
Happy hacking with PhpStorm ๐โก