PHP Pro: The Claude Code Agent That Modernizes Your PHP Stack Without the Pain
Every senior PHP developer knows the feeling: you inherit a Laravel project running PHP 7.4 patterns, mixed types scattered everywhere, no strict declarations, and a codebase that’s technically “working” but would fail any serious static analysis. Modernizing it yourself means weeks of careful refactoring, cross-referencing PHPStan output, hunting down type inconsistencies, and hoping you didn’t break anything. Then someone asks you to also add async job processing and improve test coverage to 80%+.
This is exactly the kind of work that PHP Pro was built to handle. PHP Pro is a Claude Code agent that functions as a senior PHP developer embedded in your workflow — one who has internalized PSR-12, PHPStan level 9, PHP 8.3 features, Laravel and Symfony internals, async patterns with Swoole and Fibers, and enterprise security practices. Instead of context-switching between documentation, static analysis output, and your codebase, you describe what needs to happen and PHP Pro executes with the depth of someone who has shipped PHP at scale.
The time savings aren’t marginal. Tasks that require hours of careful manual work — auditing types across a service layer, wiring up Swoole coroutines, enforcing SOLID principles across Symfony services — compress into focused, directed sessions where you’re reviewing and steering rather than grinding through implementation details.
When to Use PHP Pro
PHP Pro is purpose-built for PHP 8.3+ work in professional environments. It’s not a general-purpose coding assistant — it’s a specialist. Use it when:
- Migrating legacy codebases: You’re upgrading a PHP 7.x or early PHP 8.x project to PHP 8.3, and you need strict typing, readonly properties, enums, constructor property promotion, and match expressions introduced systematically without breaking existing behavior.
- Building high-throughput APIs: Your application needs to handle sustained load and you’re evaluating or implementing ReactPHP, Swoole coroutines, or PHP Fibers for non-blocking I/O and concurrent request processing.
- Enforcing code quality at scale: PHPStan level 9 is failing across dozens of files, test coverage is below acceptable thresholds, and you need a systematic approach to closing the gap without rewriting everything from scratch.
- Laravel service architecture: You’re designing or refactoring service layers, event-driven systems, queue job pipelines, or API resources and you want patterns that scale cleanly.
- Symfony dependency injection and DDD: Your Symfony project has grown complex and you need proper domain-driven design, hexagonal architecture, or repository patterns applied consistently.
- Security audits: You need dependency scanning, input validation review, SQL injection checks, CSRF handling verification, and authentication hardening done systematically.
- Performance profiling and optimization: OpCache configuration, JIT tuning, Eloquent query optimization, connection pooling, and autoloader optimization all require deep PHP internals knowledge.
Real-World Examples
Scenario 1: Upgrading a Laravel 10 Project to PHP 8.3 with Strict Typing
A development team has a production Laravel 10 application with five years of accumulated code. Types are mixed throughout, there are no readonly properties, enums don’t exist, and PHPStan reports hundreds of errors at level 5.
Developer: I have a Laravel 10 project that's still using mixed types and older
patterns. Can you help upgrade to PHP 8.3 with strict typing?
PHP Pro: I'll analyze your Laravel project structure, identify upgrade opportunities,
and refactor to PHP 8.3 with full strict type support, readonly properties, enums,
and modern patterns while maintaining backward compatibility. Starting with
composer.json to confirm the PHP version constraint, then auditing your service
layer for mixed type usage. I'll introduce declare(strict_types=1) file by file,
convert eligible classes to use constructor property promotion, migrate string-backed
constants to proper enums, and run PHPStan incrementally to verify clean output
at each stage. Where Eloquent models are using $fillable with untyped attributes,
I'll add proper property type hints and cast definitions. I'll flag anything where
the type change requires a behavioral decision from you.
The agent doesn’t just add type hints mechanically — it understands the Laravel ecosystem well enough to handle Eloquent’s magic properties, relationship return types, and service container bindings correctly.
Scenario 2: Implementing Async Job Processing with Swoole for 10k RPS
An engineering team needs their Laravel API to handle 10,000 requests per second. They’ve identified async job processing as the bottleneck and want to evaluate Swoole.
Developer: We need to implement async job processing with Swoole for our API
to handle 10k requests per second. Can you design this?
PHP Pro: I'll architect a Swoole-based queue system with Fiber coroutines, implement
async job batching, optimize Eloquent queries with eager loading, configure OpCache,
and set up performance monitoring to meet your throughput target. The architecture
will use a Swoole HTTP server with coroutine-based worker pools, replacing Laravel's
synchronous queue worker with non-blocking job dispatch. I'll implement connection
pooling for your database layer since traditional PDO connections don't survive
across coroutine context switches, configure OpCache preloading for your core
service classes, and add Prometheus metrics endpoints so you can observe queue
depth and worker saturation in real time. I'll also write load tests so you can
validate the 10k RPS target before deploying.
This is the kind of task that normally requires a specialist who has actually run Swoole in production — someone who knows about coroutine context issues with PDO, the OpCache preloading configuration tradeoffs, and how to instrument the system properly.
Scenario 3: PHPStan Level 9 Enforcement and Security Audit in Symfony
A Symfony project has accumulated technical debt. PHPStan is running at level 5, test coverage is at 40%, and a recent dependency audit flagged vulnerabilities.
Developer: Our Symfony project has technical debt. Can you enforce PHPStan level 9,
improve test coverage, and fix security issues?
PHP Pro: I'll run PHPStan analysis, implement strict type declarations across services
and entities, increase test coverage to 85%+, audit dependencies for vulnerabilities,
and apply SOLID principles to reduce coupling. Starting with the PHPStan baseline
at level 9 to understand the error surface, then triaging by category: missing
return types, unsafe array access, mixed type propagation, and nullable handling.
I'll fix these systematically starting with the service layer where type errors
have the most downstream impact. For test coverage, I'll identify untested code
paths using coverage reports and write PHPUnit tests with proper test doubles —
no over-mocking, focused on behavior. For security, I'll run composer audit,
patch or replace vulnerable dependencies, and audit your input validation and
authentication flows against OWASP guidelines.
What Makes PHP Pro Powerful
Complete PHP 8.3 Feature Coverage
PHP Pro has deep knowledge of every modern language feature: readonly classes and properties, backed enums, first-class callables, intersection types, named arguments, match expressions, constructor property promotion, and the never return type. It doesn’t sprinkle these in arbitrarily — it applies them where they improve correctness and clarity.
PHPStan Level 9 as the Baseline
The agent treats PHPStan level 9 as the floor, not a stretch goal. It understands generic annotations, template types, covariance and contravariance, and how to make PHPStan’s type inference work with Laravel’s magic and Symfony’s reflection-heavy internals.
Framework Internals Depth
PHP Pro understands Laravel’s service container, Eloquent’s relationship system, middleware pipeline, and queue architecture at the level needed to make architectural decisions — not just follow tutorials. On the Symfony side, it understands the dependency injection container, compiler passes, event dispatcher, and Doctrine ORM optimization.
Async Programming with Fibers and Swoole
Non-blocking PHP is still a specialized skill. PHP Pro covers ReactPHP event loops, Swoole coroutines, PHP 8.1+ Fibers, promise-based code patterns, and the practical problems that arise when running stateful frameworks like Laravel inside a persistent server process.
Security-First Mindset
Every implementation considers SQL injection prevention, XSS protection, CSRF handling, secure password hashing, session security, file upload validation, and dependency vulnerability scanning. This isn’t a checklist afterthought — it’s built into how PHP Pro approaches API design and data handling.
Performance from the Ground Up
OpCache configuration, JIT compilation tuning, Eloquent eager loading, read/write database splitting, connection pooling, and autoloader optimization are all within scope. PHP Pro understands how these interact and can reason about tradeoffs for your specific deployment environment.
How to Install PHP Pro
Installation takes under two minutes. Claude Code automatically discovers and loads agents defined in your project’s .claude/agents/ directory.
In your project root, create the agent file:
mkdir -p .claude/agents
touch .claude/agents/php-pro.md
Open .claude/agents/php-pro.md and paste the full PHP Pro system prompt into it. Save the file. The next time you start Claude Code in that project directory, the agent is available and will be invoked automatically when the context matches PHP development tasks, or you can reference it explicitly in your prompts.
No configuration files, no package installation, no environment variables. Claude Code’s agent loading is filesystem-based — if the file exists with the correct naming and location, the agent is live.
You can commit this file to your repository so the entire team benefits from the same agent configuration, or keep it local in your .gitignore if you’re experimenting.
Conclusion: Stop Manually Doing What PHP Pro Does Automatically
PHP Pro doesn’t replace your judgment — it handles the labor-intensive execution that consumes hours of senior developer time. You still make architectural decisions, you still review the output, you still decide when a type change needs a behavioral conversation. But the grinding work of propagating strict types through fifty files, configuring Swoole worker pools correctly, or systematically closing PHPStan errors at level 9 becomes something you direct rather than manually execute.
Practical next steps: install the agent in your current PHP project, start with a bounded scope — a single service class or a single module — and ask PHP Pro to analyze it against the PHP 8.3 checklist. Review what it finds and how it approaches the refactor. Once you’ve seen how it reasons about your specific codebase, you’ll have a clear sense of where to apply it at larger scale.
For teams maintaining multiple PHP services, consider making the agent part of your standard project scaffold so every new service starts with the same quality baseline baked in from day one.
Agent template sourced from the claude-code-templates open source project (MIT License).
