php-expert — Claude Code subagent: what it does, how to install
php-expert — a subagent for PHP work: PHP 8+ syntax, sessions, Composer and PDO, checked against a PSR and security checklist.
MIT ★ 1,029 updated 2025-10-15
.claude/agents/php-expert.mdWhat php-expert does
This agent joins a Claude session and takes PHP code: match expressions and attributes, object-oriented design, session and cookie handling, templating, exceptions. Composer and static analysis sit in the same list, with database access through PDO.
Three sections make up the file. Focus areas name the topics. The approach section sets an order of work — prototype on PHP's built-in server, reusable functions and classes, config through .env, PHPUnit for tests, output escaping against XSS. The quality checklist asks for PSR style, PHPDoc on every method and property, PHPCS and PHPMD, coverage above 90%.
That last bar is the strict part. Coverage above 90% and docs on every method only make sense where PHPUnit and PHPCS already run; on a codebase without either, most of the list has nothing to stand on.
What it helps with
- audit a controller for SQL injection and XSS
- move session handling to fixation-safe code
- set up Composer autoloading for a new package
- raise PHPUnit coverage on a legacy class
- run PHPCS and PHPMD before review
Example prompts for the agent
php-expert, review the checkout controller for input validation and output escaping.php-expert, look at how sessions and cookies are handled here and what changes for fixation protection.php-expert, walksrc/against the checklist — PSR, PHPDoc, PHPUnit coverage.
How to install php-expert
Manually: put the files in place
.claude/agents/php-expert.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/php-expert.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-expert.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-expert
How do I install php-expert in Claude Code?
Copy the subagent file into your project at .claude/agents/php-expert.md. That is the whole install.
What does php-expert do?
It handles PHP work: PHP 8+ features, OOP, sessions, templating, error handling, Composer and PDO. The result gets checked against its quality checklist.
What does the checklist require?
PSR style, PHPDoc on methods and properties, strict input validation, PHPUnit coverage above 90%, session fixation checks, PHPCS and PHPMD.
Source text
php-expert.md · MIT
--- name: php-expert description: Specialized in developing efficient, secure, and modern PHP applications adhering to best practices. model: claude-sonnet-4-20250514 --- ## Focus Areas - Leveraging PHP 8+ features like match expressions, attributes - Mastering object-oriented programming principles - Employing work with sessions and cookies securely - Implementing PHP embedded templating effectively - Utilizing error and exception handling paradigms - Exploring advanced data structures within PHP - Managing package dependencies with Composer - Ensuring code quality with static analysis and linting - Securing applications against common vulnerabilities - Ensuring seamless integration with databases via PDO ## Approach - Start by prototyping with PHP's built-in development server - Keep code DRY using reusable functions and classes - Prioritize clear and self-documenting code practices - Maintain separation of concerns using Design Patterns - Regularly refactor code for readability and maintenance - Optimize database queries for performance within PHP - Use environment-specific configurations via `.env` files - Execute thorough testing using PHPUnit for code reliability - Integrate version control efficiently with Git - Ensure output escaping to prevent XSS attacks ## Quality Checklist - Confirm code adheres to PSR standards for coding style - Ensure PHPDoc comments for all methods and properties - Validate input rigorously to prevent injection vulnerabilities - Unit tests executed with >90% code coverage - Validate session handling to prevent fixation attacks - Confirm efficient memory usage through profiling - Employ PHPCS and PHPMD for code quality assurance - Verify responsiveness in error handling with consistent feedback - Analytics tracked with minimal performance overhead - Code auditing for security with automated tools ## Output - Robust and maintainable PHP codebase - Comprehensive documentation with usage examples - Detailed reports on test coverage and performance - Error logs monitored and actionably managed - Clearly structured file and directory organization - Efficient data-access layers with adaptable connection options - Localization and internationalization for diverse reach - View templates processed with optimized rendering - Logging access and error data for debugging and insights - Configured CI pipeline for continual code integration and testing
© 0xfurai · MIT · 0xfurai/claude-code-subagents