Skip to content

Commit 63d3cde

Browse files
Move to PHP versions 8.X (dropped all 7.X ones) (#345)
BREAKING CHANGE This pull request drops support for PHP 7.1 and 7.4, raising the minimum required PHP version to 8.1. It updates the SDK and its dependencies accordingly, simplifies the Composer and CI workflows, and updates documentation to reflect these changes. **PHP version and dependency requirements:** * Updated `composer.json` to require `php: >=8.1.0`, `guzzlehttp/guzzle: ^7.4`, and `monolog/monolog: ^2.4 || ^3.0.0`; dropped support for older versions and removed compatibility with PHP 7.x and Guzzle 6.x. Updated dev dependencies to require `phpunit/phpunit: ^9.0` only. * Updated `README.md` to state that as of v5.0.0, the SDK requires PHP 8.1 or newer, and to explain the rationale for dropping PHP 7.x support. Updated Composer example accordingly. **Continuous Integration (CI) and workflow changes:** * Removed all references to PHP 7.1 and 7.4 from GitHub Actions workflows (`build-master.yml`, `build-pull-request.yml`, `build-release.yml`), so CI now only tests PHP 8.1 and 8.4 on supported OSes. Simplified installation and Composer steps accordingly. [[1]](diffhunk://#diff-53f6a76fa86b1994f9da743d84e130a48058a0d0657949c412c203d5f0aedfe8L17-R22) [[2]](diffhunk://#diff-53f6a76fa86b1994f9da743d84e130a48058a0d0657949c412c203d5f0aedfe8L46-L61) [[3]](diffhunk://#diff-53f6a76fa86b1994f9da743d84e130a48058a0d0657949c412c203d5f0aedfe8L84-L85) [[4]](diffhunk://#diff-53f6a76fa86b1994f9da743d84e130a48058a0d0657949c412c203d5f0aedfe8L113-L118) [[5]](diffhunk://#diff-53f6a76fa86b1994f9da743d84e130a48058a0d0657949c412c203d5f0aedfe8L130-R110) [[6]](diffhunk://#diff-104c03339b92a1f7faaf8f4d9cb603bdf4765f6f6281cee6ece6cab1331aee30L18-R32) [[7]](diffhunk://#diff-4d14704b6b88fb06db888f96c03a8e9b3a5e07a4ee566d97d4111b2c05210e84L17-R17) [[8]](diffhunk://#diff-4d14704b6b88fb06db888f96c03a8e9b3a5e07a4ee566d97d4111b2c05210e84L28-R29) **Version bump:** * Bumped the SDK version to 5.0.0 in `CheckoutUtils.php` and `version.json`. [[1]](diffhunk://#diff-41a1ea107378546a36c289e74fe7f821e2b15dd7f6b7527843468464d76be602L12-R12) [[2]](diffhunk://#diff-093664cc0c7cf4a76165141e93265eeb139f655bbee8105ed3ee2534a612354cL2-R2)
1 parent 7287932 commit 63d3cde

7 files changed

Lines changed: 32 additions & 92 deletions

File tree

‎.github/workflows/build-master.yml‎

Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,12 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
include:
17-
# Ubuntu builds (all PHP versions)
18-
- os: ubuntu-latest
19-
php-version: "7.1"
20-
- os: ubuntu-latest
21-
php-version: "7.4"
17+
# Ubuntu builds
2218
- os: ubuntu-latest
2319
php-version: "8.1"
2420
- os: ubuntu-latest
2521
php-version: "8.4"
26-
# Windows builds (no PHP 7.1 due to SSL compatibility issues)
27-
- os: windows-latest
28-
php-version: "7.4"
22+
# Windows builds
2923
- os: windows-latest
3024
php-version: "8.1"
3125
- os: windows-latest
@@ -42,24 +36,14 @@ jobs:
4236
sudo apt-get install -y software-properties-common
4337
sudo add-apt-repository ppa:ondrej/php -y
4438
sudo apt-get update
45-
46-
# Install PHP and required extensions
47-
if [[ "${{ matrix.php-version }}" == "7.1" || "${{ matrix.php-version }}" == "7.4" ]]; then
48-
# PHP 7.x installations
49-
sudo apt-get install -y php${{ matrix.php-version }} php${{ matrix.php-version }}-cli php${{ matrix.php-version }}-common
50-
sudo apt-get install -y php${{ matrix.php-version }}-curl php${{ matrix.php-version }}-json php${{ matrix.php-version }}-mbstring
51-
sudo apt-get install -y php${{ matrix.php-version }}-xml php${{ matrix.php-version }}-zip php${{ matrix.php-version }}-xdebug
52-
# Try to install fileinfo if package exists, ignore if not (often built-in)
53-
sudo apt-get install -y php${{ matrix.php-version }}-fileinfo 2>/dev/null || true
54-
else
55-
# PHP 8.x installations (json is built-in, no separate package)
56-
sudo apt-get install -y php${{ matrix.php-version }} php${{ matrix.php-version }}-cli php${{ matrix.php-version }}-common
57-
sudo apt-get install -y php${{ matrix.php-version }}-curl php${{ matrix.php-version }}-mbstring
58-
sudo apt-get install -y php${{ matrix.php-version }}-xml php${{ matrix.php-version }}-zip
59-
# Try to install fileinfo if package exists, ignore if not (often built-in)
60-
sudo apt-get install -y php${{ matrix.php-version }}-fileinfo 2>/dev/null || true
61-
fi
62-
39+
40+
# Install PHP and required extensions (PHP 8.x; json is built-in, no separate package)
41+
sudo apt-get install -y php${{ matrix.php-version }} php${{ matrix.php-version }}-cli php${{ matrix.php-version }}-common
42+
sudo apt-get install -y php${{ matrix.php-version }}-curl php${{ matrix.php-version }}-mbstring
43+
sudo apt-get install -y php${{ matrix.php-version }}-xml php${{ matrix.php-version }}-zip
44+
# Try to install fileinfo if package exists, ignore if not (often built-in)
45+
sudo apt-get install -y php${{ matrix.php-version }}-fileinfo 2>/dev/null || true
46+
6347
# Set PHP as default
6448
sudo update-alternatives --set php /usr/bin/php${{ matrix.php-version }}
6549
@@ -81,8 +65,6 @@ jobs:
8165
8266
# Download PHP based on version
8367
switch ($phpVersion) {
84-
"7.1" { $downloadUrl = "https://downloads.php.net/~windows/releases/archives/php-7.1.33-Win32-VC14-x64.zip" }
85-
"7.4" { $downloadUrl = "https://downloads.php.net/~windows/releases/php-7.4.33-Win32-vc15-x64.zip" }
8668
"8.1" { $downloadUrl = "https://downloads.php.net/~windows/releases/php-8.1.34-Win32-vs16-x64.zip" }
8769
"8.4" { $downloadUrl = "https://downloads.php.net/~windows/releases/php-8.4.21-Win32-vs17-x64.zip" }
8870
default { throw "Unsupported PHP version: $phpVersion" }
@@ -110,12 +92,8 @@ jobs:
11092
echo "$phpDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
11193
$env:PATH = "$phpDir;$env:PATH"
11294
113-
# Download and setup Composer (use 2.2 LTS for PHP 7.1, stable for others)
114-
if ($phpVersion -eq "7.1") {
115-
$composerUrl = "https://getcomposer.org/download/2.2.24/composer.phar"
116-
} else {
117-
$composerUrl = "https://getcomposer.org/composer-stable.phar"
118-
}
95+
# Download and setup Composer
96+
$composerUrl = "https://getcomposer.org/composer-stable.phar"
11997
Invoke-WebRequest -Uri $composerUrl -OutFile "$phpDir\composer.phar"
12098
echo "@echo off" | Out-File -FilePath "$phpDir\composer.bat" -Encoding ascii
12199
echo "php `"%~dp0composer.phar`" %*" | Out-File -FilePath "$phpDir\composer.bat" -Encoding ascii -Append
@@ -127,17 +105,9 @@ jobs:
127105
shell: bash
128106
run: composer validate
129107

130-
- name: Composer install (conditional)
108+
- name: Composer update
131109
shell: bash
132-
run: |
133-
# Install dependencies based on PHP version
134-
if [[ "${{ matrix.php-version }}" == "7.1" ]]; then
135-
# Ubuntu PHP 7.1 - use standard composer
136-
composer install;
137-
else
138-
# PHP 7.4, 8.1, 8.4 - update to newer package versions
139-
composer require guzzlehttp/guzzle:"^7.4" guzzlehttp/promises:"^2.0" phpunit/phpunit:"^9.5" --dev --with-all-dependencies;
140-
fi
110+
run: composer update --prefer-dist --no-interaction
141111

142112
- name: Run PHPStan
143113
run: vendor/bin/phpstan analyse --no-progress

‎.github/workflows/build-pull-request.yml‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,21 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
os: [ubuntu-latest]
18-
php-version: ["7.1", "7.4", "8.1", "8.4"]
18+
php-version: ["8.1", "8.4"]
1919

2020
steps:
2121
- uses: actions/checkout@v2
2222

2323
- name: Install PHP from official repositories
2424
run: |
2525
sudo apt-get update
26-
if [[ "${{ matrix.php-version }}" == "7.1" || "${{ matrix.php-version }}" == "7.4" ]]; then
27-
# For older versions, use system default
28-
sudo apt-get install -y php php-cli php-common php-curl php-json php-mbstring php-xml php-zip php-fileinfo php-xdebug
29-
else
30-
# For newer versions, install available system packages
31-
sudo apt-get install -y php php-cli php-common php-curl php-json php-mbstring php-xml php-zip php-fileinfo
32-
fi
26+
sudo apt-get install -y php php-cli php-common php-curl php-json php-mbstring php-xml php-zip php-fileinfo
3327
3428
- name: Composer validate
3529
run: composer validate
3630

37-
- name: Composer install (conditional)
38-
run: |
39-
if [[ "${{ matrix.php-version }}" == "7.1" ]]; then
40-
composer install;
41-
else
42-
composer require guzzlehttp/guzzle:"^7.4" guzzlehttp/promises:"^2.0" phpunit/phpunit:"^9.5" --dev --with-all-dependencies;
43-
fi
31+
- name: Composer update
32+
run: composer update --prefer-dist --no-interaction
4433

4534
- name: Run PHPStan
4635
run: vendor/bin/phpstan analyse --no-progress

‎.github/workflows/build-release.yml‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616

17-
- name: Install PHP 7.1 from official repositories
17+
- name: Install PHP from official repositories
1818
run: |
1919
sudo apt-get update
2020
sudo apt-get install -y php php-cli php-common php-curl php-json php-mbstring php-xml php-zip php-fileinfo
@@ -25,11 +25,8 @@ jobs:
2525
- name: Composer validate
2626
run: composer validate
2727

28-
- name: Composer update with promises:^1.5
29-
run: |
30-
composer remove guzzlehttp/promises --no-update
31-
composer require guzzlehttp/promises:^1.5 --no-update
32-
composer update --prefer-dist --no-interaction
28+
- name: Composer update
29+
run: composer update --prefer-dist --no-interaction
3330

3431
- name: Run PHPUnit
3532
env:

‎README.md‎

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,20 @@
3333
* [API Reference (Default)](https://api-reference.checkout.com/)
3434
* [API Reference (Previous)](https://api-reference.checkout.com/previous)
3535

36-
### ⚠️ PHP 8.1+ Compatibility
36+
### ⚠️ PHP version support
3737

38-
If you’re using PHP 8.1 or newer, you may encounter warnings such as:
38+
As of **v5.0.0**, this SDK requires **PHP 8.1 or newer**. Support for PHP 7.1 and 7.4 has been dropped.
3939

40-
```
41-
Deprecated: implicitly marking parameter as nullable is deprecated
42-
```
43-
44-
This is caused by older dependencies (e.g. guzzlehttp/promises:^1.x or phpunit/phpunit:^5.7) that are no longer compatible with PHP 8.1+.
45-
46-
✅ To fix this, update your dev dependencies:
47-
48-
```bash
49-
composer require phpunit/phpunit:^9.5 --dev --with-all-dependencies
50-
```
51-
52-
And if you’re using PHP 8+ and no longer need to support PHP 7.1, you may also upgrade Guzzle:
53-
54-
```bash
55-
composer require guzzlehttp/guzzle:^7.4 guzzlehttp/promises:^2.0 --with-all-dependencies
56-
```
40+
This change is required because the SDK now depends on `guzzlehttp/guzzle:^7.4` (and `guzzlehttp/promises:^2.0`), which require PHP 8.0+. Older Guzzle and PHPUnit releases that supported PHP 7.x are affected by security advisories that make them unsuitable for a payment SDK.
5741

58-
These updates ensure compatibility with modern PHP versions but drop support for PHP 7.1.
42+
If you are still on PHP 7.x, remain on the latest `4.x` release until you can upgrade your runtime to PHP 8.1+.
5943

6044
#### Composer
6145

6246
```json
6347
{
6448
"require": {
65-
"php": ">=7.1",
49+
"php": ">=8.1",
6650
"checkout/checkout-sdk-php": "version"
6751
}
6852
}

‎composer.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
}
2727
],
2828
"require": {
29-
"php": ">=7.1.0",
30-
"guzzlehttp/guzzle": "^6.5 || ^7.4",
31-
"monolog/monolog": "^1.27 || ^2.4 || ^3.0.0" ,
29+
"php": ">=8.1.0",
30+
"guzzlehttp/guzzle": "^7.4",
31+
"monolog/monolog": "^2.4 || ^3.0.0" ,
3232
"ext-json": "*",
3333
"ext-fileinfo": "*"
3434
},
3535
"require-dev": {
36-
"phpunit/phpunit": "^5.7 || ^9.0",
36+
"phpunit/phpunit": "^9.0",
3737
"symfony/phpunit-bridge": "^5.2 || ^6.0",
3838
"mockery/mockery": "^1.3 || ^1.4",
3939
"phpstan/phpstan": "^1.2",

‎lib/Checkout/CheckoutUtils.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class CheckoutUtils
99
{
1010

1111
const PROJECT_NAME = "checkout-sdk-php";
12-
const PROJECT_VERSION = "4.10.0";
12+
const PROJECT_VERSION = "5.0.0";
1313

1414
/**
1515
* @param DateTime $date

‎version.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "4.10.0"
2+
"version": "5.0.0"
33
}

0 commit comments

Comments
 (0)