php-modernization

Modernize legacy PHP projects to PHP 8.x with type safety.

51|13|Updated Oct 18, 2025
One-click install
npx skills add https://github.com/netresearch/claude-code-marketplace --skill php-modernization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-modernization
Source: https://github.com/netresearch/claude-code-marketplace/tree/main/skills/php-modernization
Command: npx skills add https://github.com/netresearch/claude-code-marketplace --skill php-modernization

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires rector, phpstan, php-cs-fixer, composer, and includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill guides PHP modernization to PHP 8.x, including type safety, Rector migrations, and PHPStan compliance.

Core Features & Use Cases

  • PHP 8.x Features: Promotions, enums, attributes, and union types.
  • Static Analysis: PHPStan level 9+ compliance guidance.
  • Migration Strategies: Rector-based PHP migrations and Symfony patterns.

Quick Start

Apply PHP 8.x modernization with Rector and PHPStan in a modernized PHP project.

Frequently Asked Questions about php-modernization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I upgrade a legacy PHP project to PHP 8.x with type safety?

PHP 8.x upgrades modernize codebases with type safety by applying Rector-based automated migrations, PHPStan static analysis, and native features like constructor property promotion, readonly properties, enums, and union types. Rector handles syntax conversions while PHPStan enforces type compliance to level 9+.

What's the best way to migrate from YAML service configuration to PHP in Symfony?

Migrate Symfony YAML service configuration to PHP by running Rector migrations targeting PHP 8.x patterns. This conversion modernizes service definitions into type-safe PHP arrays and attributes, improving IDE support and reducing configuration friction.

Can I use Rector and PHPStan together to modernize PHP code?

Yes. Rector automates structural migrations—constructor promotion, union types, attributes—while PHPStan validates type safety at configurable levels. Running Rector first, then PHPStan, ensures migrations are both syntactically correct and type-compliant across your codebase.

What are the key PHP 8.x features I can adopt during modernization?

PHP 8.x enables constructor property promotion, readonly properties, enums, attributes, union and intersection types, and named arguments. These features reduce boilerplate, improve type safety, and enhance code readability when applied during systematic migration.

Do I need all dependencies—Rector, PHPStan, php-cs-fixer, and Composer—to modernize PHP?

Rector handles migrations and feature adoption; PHPStan enforces static type analysis; php-cs-fixer standardizes code style; Composer manages dependencies. All three work synergistically. Rector and PHPStan are core; php-cs-fixer and Composer support the complete modernization workflow.

What's the difference between using Rector for PHP modernization versus manual refactoring?

Rector automates large-scale, repetitive migrations—type hints, attribute conversions, Symfony pattern upgrades—reducing error and time. Manual refactoring scales poorly on legacy codebases. Rector's rule-based approach ensures consistency and completeness across thousands of files.