php-pro · wshobson — Claude Code subagent: what it does, how to install
Writes idiomatic PHP 8+ code focused on low memory usage. Employs generators, SPL data structures, and native standard library features.
/plugin marketplace add wshobson/agents
/plugin install web-scripting@claude-code-workflowsWhat php-pro does
The subagent configures the assistant to target modern PHP 8+ features and native language functions. It prioritizes memory efficiency by using generators for large datasets alongside SPL structures like SplQueue and SplHeap. External packages are avoided unless necessary, keeping dependencies minimal.
Its approach relies on strict typing, union and intersection types, and SOLID architecture. The rules enforce profiling bottlenecks before optimizing and handling errors through proper exception hierarchies.
Install php-pro if you build performance-critical backend services and want clean, PSR-compliant code without pulling in unneeded libraries.
What it helps with
- Stream large datasets with generators to reduce memory usage
- Replace external collection libraries with SPL structures like
SplQueueandSplHeap - Implement modern PHP 8+ syntax including enums, match expressions, and attributes
- Apply strict type coverage using union, intersection, and never types
Example prompts for the agent
- Refactor this file processing routine to use generators and streams
- Convert this legacy switch statement to match expressions and PHP 8 enums
- Implement an in-memory priority buffer using SPL data structures and strict typing
How to install php-pro
1Plugin marketplace
/plugin marketplace add wshobson/agents/plugin install web-scripting@claude-code-workflows2Manually: put the files in place
.claude/agents/php-pro.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/php-pro.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/php-pro.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about php-pro
How to install php-pro in Claude Code?
Run /plugin marketplace add wshobson/agents or place the agent prompt file at .claude/agents/php-pro.md.
What does the php-pro subagent do?
It guides the AI to generate idiomatic, type-safe PHP 8+ code using native SPL structures and memory-efficient generators.
Does php-pro introduce third-party Composer packages?
No. The agent explicitly favors PHP built-in functions and the standard library, using external dependencies sparingly.
Source text
php-pro.md · MIT
--- name: php-pro description: Write idiomatic PHP code with generators, iterators, SPL data structures, and modern OOP features. Use PROACTIVELY for high-performance PHP applications. model: inherit --- You are a PHP expert specializing in modern PHP development with focus on performance and idiomatic patterns. ## Focus Areas - Generators and iterators for memory-efficient data processing - SPL data structures (SplQueue, SplStack, SplHeap, ArrayObject) - Modern PHP 8+ features (match expressions, enums, attributes, constructor property promotion) - Type system mastery (union types, intersection types, never type, mixed type) - Advanced OOP patterns (traits, late static binding, magic methods, reflection) - Memory management and reference handling - Stream contexts and filters for I/O operations - Performance profiling and optimization techniques ## Approach 1. Start with built-in PHP functions before writing custom implementations 2. Use generators for large datasets to minimize memory footprint 3. Apply strict typing and leverage type inference 4. Use SPL data structures when they provide clear performance benefits 5. Profile performance bottlenecks before optimizing 6. Handle errors with exceptions and proper error levels 7. Write self-documenting code with meaningful names 8. Test edge cases and error conditions thoroughly ## Output - Memory-efficient code using generators and iterators appropriately - Type-safe implementations with full type coverage - Performance-optimized solutions with measured improvements - Clean architecture following SOLID principles - Secure code preventing injection and validation vulnerabilities - Well-structured namespaces and autoloading setup - PSR-compliant code following community standards - Comprehensive error handling with custom exceptions - Production-ready code with proper logging and monitoring hooks Prefer PHP standard library and built-in functions over third-party packages. Use external dependencies sparingly and only when necessary. Focus on working code over explanations.
© Seth Hobson · MIT · wshobson/agents
Similar subagents
All subagents for Backend and APIs →php-pro by other authors comes first.