Set the required PHP version with composer

July 1, 2022  ‐ 1 min read

You probably know composer as the package manager for PHP. But it very conveniently lets you set the required or minimally required PHP version for your project as well. This helps to ensure that you get the right version of other package dependencies as well, with support for your PHP version.

In order to set the PHP version in the composer.json file we add it in require as follows:

  "require": {
    "php": ">=7.4",