Skip to main content
subagent CX Codex

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

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/php-expert.md
Open on GitHub

What 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, walk src/ against the checklist — PSR, PHPDoc, PHPUnit coverage.

How to install php-expert

Manually: put the files in place

.claude/agents/php-expert.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

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

Similar subagents

All subagents for Programming languages →

From the same set137

The whole set →
fastapi-expert fastapi-expert is a Claude Code subagent for structuring FastAPI services, validating APIs, and adding tests. It handles application design and security tasks. CX Codex ★ 1,029repo stars ios-expert ios-expert is a Claude Code subagent for building iOS apps with Swift and SwiftUI. It handles app architecture and Swift optimization tasks. CX Codex ★ 1,029repo stars perl-expert perl-expert is a Claude Code subagent for Perl scripting, regular expressions, data parsing, and CPAN modules. CX Codex ★ 1,029repo stars nestjs-expert nestjs-expert is a Claude Code subagent for structuring NestJS applications and REST APIs. It handles architecture, validation, route protection, and tests. CX Codex ★ 1,029repo stars aspnet-core-expert aspnet-core-expert — a subagent for designing, debugging, and optimizing ASP.NET Core web services, middleware, and database access. CX Codex ★ 1,029repo stars sql-expert The sql-expert subagent handles complex SQL, execution plans, indexes, schemas, and transactions. Use it when a query or database design needs a closer review. CX Codex ★ 1,029repo stars docker-expert docker-expert — a Claude subagent for Docker work: Dockerfiles, Compose stacks, volumes, networking, health checks and registries. CX Codex ★ 1,029repo stars cockroachdb-expert cockroachdb-expert — a subagent for CockroachDB cluster setup, schema design, and distributed SQL query tuning. Helps configure multi-region replication and backup routines. CX Codex ★ 1,029repo stars

Project sponsors

Companies that keep this analytics open