Skip to content

Commit

Permalink
[#462] Removed PHP version from composer.json.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed May 14, 2024
1 parent 55f4e54 commit e233829
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,34 @@ section of composer.json:

### How do I specify a PHP version?

This project supports PHP 8.3 as minimum version (see [PHP requirements](https://www.drupal.org/docs/system-requirements/php-requirements)), however it's possible that a `composer update` will upgrade some package that will then require PHP 8.3+.
There are 2 places where Composer will be looking for PHP version requirements
when resolving dependencies:
1. The `require.php` version value in `composer.json`.
2. The `config.platform` version value in `composer.json`.

To prevent this you can add this code to specify the PHP version you want to use in the `config` section of `composer.json`:
The purpose of `require.php` is to set the minimum PHP language requirements
for a package. For example, the minimum version required for Drupal 11.0 is
`8.3` or above, which can be specified as `>=8.3`.

The purpose of `config.platform` is to set the PHP language requirements for the
specific instance of the package running in the current environment. For
example, while the minimum version required for Drupal 11 is `8.3` or above,
the actual PHP version on the hosting provider could be `8.3.1`. The value of
this field should provide your exact version of PHP with all 3 parts of the
version.

#### Which versions to specify in my Drupal site?

This project includes `drupal/core` which already has `require.php` added. Your
would inherit that constraint. There is no need to add `require.php` to your
`composer.json`.

`config.platform` is a platform-specific. It is recommended to specify
`config.platform` as a _specific version_ (e.g.`8.3.1`) constraint to ensure
that only the package versions supported by your current environment are used.

```json
"config": {
"sort-packages": true,
"platform": {
"php": "8.3.1"
}
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
}
],
"require": {
"php": ">=8.3",
"composer/installers": "^2.1",
"cweagans/composer-patches": "^1.7",
"drupal/core-composer-scaffold": "^11@alpha",
Expand Down

0 comments on commit e233829

Please sign in to comment.