Skip to content

Commit 7fab10d

Browse files
committed
[#462] Removed PHP version from composer.json.
1 parent 2a222fe commit 7fab10d

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,34 @@ section of composer.json:
123123

124124
### How do I specify a PHP version?
125125

126-
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+.
126+
There are 2 places where Composer will be looking for PHP version requirements
127+
when resolving dependencies:
128+
1. The `require.php` version value in `composer.json`.
129+
2. The `config.platform` version value in `composer.json`.
127130

128-
To prevent this you can add this code to specify the PHP version you want to use in the `config` section of `composer.json`:
131+
The purpose of `require.php` is to set the minimum PHP language requirements
132+
for a package. For example, the minimum version required for Drupal 11.0 is
133+
`8.3` or above, which can be specified as `>=8.3`.
134+
135+
The purpose of `config.platform` is to set the PHP language requirements for the
136+
specific instance of the package running in the current environment. For
137+
example, while the minimum version required for Drupal 11 is `8.3` or above,
138+
the actual PHP version on the hosting provider could be `8.3.1`. The value of
139+
this field should provide your exact version of PHP with all 3 parts of the
140+
version.
141+
142+
#### Which versions to specify in my Drupal site?
143+
144+
This project includes `drupal/core` which already has `require.php` added. Your
145+
would inherit that constraint. There is no need to add `require.php` to your
146+
`composer.json`.
147+
148+
`config.platform` is a platform-specific. It is recommended to specify
149+
`config.platform` as a _specific version_ (e.g.`8.3.1`) constraint to ensure
150+
that only the package versions supported by your current environment are used.
129151

130152
```json
131153
"config": {
132-
"sort-packages": true,
133154
"platform": {
134155
"php": "8.3.1"
135156
}

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=8.3",
2019
"composer/installers": "^2.1",
2120
"cweagans/composer-patches": "^1.7",
2221
"drupal/core-composer-scaffold": "^11@alpha",

0 commit comments

Comments
 (0)