/php-modernization:php-modernizationfrom php-modernization
Modernizes PHP codebases with PHP 8.1-8.5 features, PSR/PER-CS compliance, and type safety. Uses Rector, PHPStan, PHP-CS-Fixer, and PHPat for automated refactoring and static analysis.
Ships in php-modernization. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Discover: uv run ${CLAUDE_SKILL_DIR}/scripts/introspect.py (cheap), or verify_php_project.py --summary (full, with agent_actions[]). Then read the project's own commands — composer.json scripts, Makefile, DDEV/Docker wrappers, CI config. They fix the runtime, the config and the paths; use them over a bare vendor/bin/* call. Exception: when you must add a flag (--dry-run, --only, a path), run the command the script wraps with the flag written out, in the same runtime — Composer aliases can drop ---forwarded flags.
Drill: ... --check PM-XX per finding. Full output when triaging >3. The verifier does not evaluate llm_review checkpoints (step 4): no result for one is no pass.
Use the project's tools, and run them. Naming a tool is not using it. A check you did not run is reported as not run.
| Concern | Tool (the one the project has) |
|---|---|
| PHP refactoring | Rector (+ TYPO3/Symfony sets) |
| Fluid, TypoScript, FlexForm/XML, YAML migration | Fractor — not for PHP code |
Types, match completeness (match.unhandled), version floor (phpVersion) | PHPStan |
| Coding standard | PHPCS/PHPCBF or PHP-CS-Fixer — whichever is configured |
| Syntax | php -l / the project's lint, under the lowest supported PHP |
| Behaviour | PHPUnit (the project's suite) |
| Test strength on the changed lines | Infection, where installed |
Decide what the tools cannot. Before each change, answer from callers, data flow and tests:
The verifier runs mechanical checks only. The llm_review checkpoints in checkpoints.yaml (enums PM-21, PHP 8 features and match PM-22, readonly PM-40, …) are yours; a green verifier does not cover them.
Apply in bounded steps: baseline tests → modernize_loop.py --mode dry-run or rector process <path> --only=<rule> --dry-run (when the project's own command adds a config or a container, run that command with the flags instead: the orchestrator calls the binaries directly) → review the diff against step 4 → apply → formatter → lint, PHPStan, tests → the same dry-run again proposes nothing → commit. Details: references/migration-strategies.md.
References: load on demand; do not pre-load.
| Need | Read |
|---|---|
| PHP 8.0-8.3 baseline | references/php8-features.md |
| PHP 8.4 | references/php-8.4.md |
| PHP 8.5 | references/php-8.5.md |
| PSR / PER-CS | references/psr-per-compliance.md |
| PHPStan config | references/phpstan-compliance.md |
| Static analysis | references/static-analysis-tools.md |
| PHP-CS-Fixer deprecations | references/php-cs-fixer-deprecations.md |
| DTOs / VOs / inputs | references/type-safety.md, references/request-dtos.md |
| Adapter / registry | references/adapter-registry-pattern.md |
| Multi-version compat | references/multi-version-adapters.md, references/composer-package-metadata.md |
| Symfony patterns | references/symfony-patterns.md |
| PSR-15 middleware | references/psr15-middleware-architecture.md |
| Doctrine edges | references/doctrine-modernization-edges.md |
| API Platform | references/api-platform-edges.md |
| Immutability | references/immutability-boundaries.md |
| Contracts & invariants | references/contracts-and-invariants.md |
| Mutation testing | references/mutation-testing.md |
| Lexing PHP as tokens, across versions | references/lexing-php-across-versions.md |
| Migration planning | references/migration-strategies.md |
| Public API inventory vs consumers, interface changes on update | references/public-api-inventory.md |
| PHPUnit 12→13, mock vs stub | references/phpunit-modernization.md |
| Multi-agent dispatch hazards | references/multi-agent-pitfalls.md |
| Reading a PHP config file without running it | references/reading-php-config-safely.md |
readonly to Doctrine entities or mapped-superclasses (embeddables: see references/doctrine-modernization-edges.md).modernize_loop.py --mode apply --confirm) before a --dry-run of the same scope and a review of its diff. Rector diffs can change behaviour (loose switch → strict match, readonly over mutable members). Pass --dry-run on the Rector command itself (the one the project's script runs, in its runtime), never through a Composer alias with --: depending on the configuration the alias drops it.final to mock targets or extension points without confirmation.@generated files or files under var/cache/, vendor/, node_modules/, .Build/.git checkout -- files outside your scope in shared trees — use git stash / git diff.rm -rf /tmp/phpstan /tmp/phpstan-* var/cache/phpstan first. PHPStan and Rector caches outlive git worktree remove (references/multi-agent-pitfalls.md, Hazard 9).memory_limit is 128M; PHPStan stops at it on larger projects ("reached configured PHP memory limit"). Pass --memory-limit=1G.createMock → createStub — promote to expects(...)->method(...)->with(...).declare(strict_types=1) everywhere@PER-CS, no deprecated aliasestreatPhpDocTypesAsCertain: false); 10 for new#[Override] (8.3+), #[SensitiveParameter] (8.2+), typed constants (8.3+)array_find/any/all (8.4); pipe |> (8.5)createStub, mocks createMock + expects (no self::any() in 13)withComposerBased(symfony: true) (per-version SymfonySetList::SYMFONY_* are @deprecated)checkpoints.yaml (opens in a new tab)references/adapter-registry-pattern.md (opens in a new tab)references/api-platform-edges.md (opens in a new tab)references/composer-package-metadata.md (opens in a new tab)references/contracts-and-invariants.md (opens in a new tab)references/core-rules.md (opens in a new tab)references/doctrine-modernization-edges.md (opens in a new tab)references/immutability-boundaries.md (opens in a new tab)references/lexing-php-across-versions.md (opens in a new tab)references/migration-strategies.md (opens in a new tab)references/multi-agent-pitfalls.md (opens in a new tab)references/multi-version-adapters.md (opens in a new tab)references/mutation-testing.md (opens in a new tab)references/php-8.4.md (opens in a new tab)references/php-8.5.md (opens in a new tab)references/php-cs-fixer-deprecations.md (opens in a new tab)references/php8-features.md (opens in a new tab)references/phpstan-compliance.md (opens in a new tab)references/phpunit-modernization.md (opens in a new tab)references/psr-per-compliance.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
php-modernization, rector, phpstan, php-cs-fixer, type-safety, psr-compliance
php-modernization@netresearch-claude-code-marketplace is listed by netresearch/claude-code-marketplace — review the source before installing
npx claudepluginhub netresearch/claude-code-marketplace --plugin php-modernizationOther plugins' skills for the same job