Migrate to cloud: Upgrade the PHP version

Edit on GitHub

After you have integrated the Docker SDK, you have to upgrade the PHP version. To upgrade, follow these steps.

1. Check project code for PHP 8.1 compatibility using PHPCompatibility

To check the project code, do the following:

  1. Require the php-compatibility package:
composer require --dev phpcompatibility/php-compatibility --ignore-platform-reqs
  1. Tune phpcs settings to allow php-compatibility rules:
vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility
  1. Execute the php-compatibility sniffer:
vendor/bin/phpcs -p src/ --standard=PHPCompatibility  --runtime-set testVersion 8.1

This returns the code that’s not compatible with PHP 8.1.

  1. Fix all discovered incompatibilities.

2. Check composer dependencies for PHP 8.1 compatibility

To check composer dependencies, do the following:

  1. To discover all incompatible composer packages with the required PHP version, run the following command:
composer why-not php 8.1
  1. Update packages to make composer dependencies compatible with PHP 8.1.

  2. Update platform requirements:

  "config": {
    "preferred-install": "dist",
    "platform": {
      "php": "8.1"
    },

3. Change the Docker image to php 8.1

Add the new PHP version in every deploy.yml file:

image:
    tag: spryker/php:8.1
    environment:

Next step

Migrate non-standard services