← Back to the catalog

Skill · Version 1.0.0

PHP and Composer upgrades

Upgrades PHP dependencies within real runtime and ecosystem constraints while preserving deliberate Composer lockfile changes.

composer-php-upgrades

See how it helps

When is it useful?

Use when PHP packages must move versions without breaking the deployed runtime.

What does it help you do?

  • Compares actual PHP and extension versions with Composer platform constraints.
  • Diagnoses dependency blockers and updates only the intended coupled package family.
  • Checks lockfile, autoloading, framework configuration and affected analysis tools.

Try asking this

Plan a Laravel package upgrade on our production PHP version without ignoring platform requirements. Run the proposed dependency set against the actual PHP extensions. Identify any blocker with its version constraint and verify the affected application path after installation.

Detailed documentation

Read the skill’s original instructions, examples and checks in their authored language.

Details…Show less

Composer & PHP Upgrades

When to Use

Use when upgrading PHP libraries, frameworks (Laravel, Symfony, Doctrine, Filament, Livewire, Pest/PHPUnit, PHPStan/Psalm), or PHP runtime targets via composer.json and composer.lock.

Platform & Constraint Discovery

1. Inspect PHP Runtime vs. config.platform
  • Check both require.php (e.g., "^8.2", "~8.3.0") and config.platform.php in composer.json, alongside Dockerfile / docker-compose.yml / CI matrix PHP versions and required PHP extensions (ext-intl, ext-gd, ext-redis, ext-imagick, ext-pcntl, ext-bcmath, ext-sodium).
  • Warning: config.platform.php tells Composer to emulate a specific PHP version when resolving composer.lock even if the local CLI runs a newer PHP version. Always keep config.platform aligned with the lowest production PHP runtime, and never use --ignore-platform-reqs (--ignore-platform-req=php) to force an incompatible package into composer.lock.
2. Trace Dependency Blockers Before Updating

Use Composer's built-in solver diagnostics before changing constraints:

  • composer why <vendor/package> (depends): Shows which direct or transitive packages require the installed package.
  • composer why-not <vendor/package> <target-version> (prohibits): Shows the exact version constraint chain (PHP version, sibling package, or root composer.json) blocking the upgrade.
  • composer outdated --direct: Lists outdated direct dependencies and indicates semver-safe vs. major updates.

Controlled Update Execution

1. Scoped composer update Commands
  • Never run a bare composer update across the whole project when upgrading a specific library—that recalculates and bumps every unlocked package in composer.lock.
  • Always scope updates to the target package and its coupled dependents:
    • composer update vendor/package --with-all-dependencies (-W)
    • For coupled framework families (e.g., symfony/*, illuminate/*, spatie/*), pass all related packages together: composer update "symfony/*" --with-all-dependencies.
  • Validate manifest integrity with composer validate --strict.
2. Framework & Ecosystem Upgrade Nuances
  • Laravel (laravel/framework):
    • Upgrade coupled first-party packages in lockstep (laravel/sanctum, laravel/horizon, laravel/passport, laravel/cashier, laravel/octane, laravel/pint, nunomaduro/collision, pestphp/pest / phpunit/phpunit).
    • Check composer.json scripts (@php artisan package:discover --ansi, @php artisan vendor:publish), middleware registration (bootstrap/app.php in Laravel 11+ vs app/Http/Kernel.php), Eloquent cast/model signature changes, and published config files (config/*.php).
  • Symfony (symfony/*):
    • Check extra.symfony.require in composer.json (which restricts Symfony Flex recipes and symfony/* component versions!). Updating require without updating extra.symfony.require causes solver failures.
    • Check Symfony Flex recipe diffs (composer recipes, composer recipes:update) for updated bundle configs (config/packages/*.yaml) and DI container deprecations (bin/console debug:container --deprecations).
  • Static Analysis & Tests (phpstan/phpstan, larastan/larastan, vimeo/psalm, phpunit/phpunit, pestphp/pest):
    • PHPUnit major upgrades (e.g., PHPUnit 9 $\rightarrow$ 10 $\rightarrow$ 11) replace docblock annotations (@test, @dataProvider) with PHP 8 attributes (#[Test], #[DataProvider]), tighten phpunit.xml schemas (phpunit --migrate-configuration), and make data provider methods static.
    • When upgrading PHPStan/Larastan, fix newly surfaced type errors in application code rather than bloating phpstan-baseline.neon.
3. Composer Plugins, Patches & Autoloading
  • Check config.allow-plugins when a new plugin package is introduced.
  • If cweagans/composer-patches is used, verify whether each .patch file still applies cleanly or was merged upstream.
  • Always run composer dump-autoload --strict-psr (or --optimize) and verify zero PSR-4 autoloading warnings.

Included files 1

  • SKILL.md

About this skill package

composer-php-upgrades

composer-php-upgrades: Upgrade dependencies and frameworks with a clear compatibility plan, migration steps and regression evidence.

Details…Show less

composer-php-upgrades

composer-php-upgrades: Upgrade dependencies and frameworks with a clear compatibility plan, migration steps and regression evidence.

Includes the complete skill and its supporting files (1 files). The exact authored scope is preserved below.

Original skill description (source language)

Use when upgrading PHP and Composer packages, Laravel/Symfony ecosystems, PHP extensions, and runtime platform constraints with strict composer.lock hygiene.

Install the skill, review its source and trust settings, then enable it for the relevant project or agent.

Requirements

  • Orqestria installed on your computer.