Skip to content

Commit ec034f1

Browse files
authored
Drop eol php 7 (#361)
* Drop eol php 7.3 7.4 * Add php 8.2 to Github tests * test with disabled `gmp` extension * Add extension suggestion to composer * Remove outdated php 7.x code
1 parent a7c012a commit ec034f1

File tree

5 files changed

+36
-49
lines changed

5 files changed

+36
-49
lines changed

.github/ISSUE_TEMPLATE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ helps with diagnosing problems quicker.
1212
> better.
1313
1414
* *Operating System*: <Linux | Windows | OS X>
15-
* *PHP Version*: <5.6 | 7.0 | ...>
16-
* *web-push-php Version*: <1.0.0>
15+
* *PHP Version*: <8.0 | 8.1 | ...>
16+
* *web-push-php Version*: <8.0.0>
1717

1818
> Please check that you have installed and enabled these PHP extensions :
1919
20+
- [ ] curl
2021
- [ ] gmp
2122
- [ ] mbstring
22-
- [ ] curl
2323
- [ ] openssl
2424

2525
> Please select any browsers that you are experiencing problems with:

.github/workflows/tests.yml

+23-33
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,46 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
php: ['7.3', '7.4', '8.0', '8.1']
18+
php: ['8.0', '8.1', '8.2']
19+
ext: ['curl, mbstring, openssl', 'curl, mbstring, openssl, gmp']
1920

20-
name: PHP ${{ matrix.php }}
21+
name: PHP ${{ matrix.php }} (${{ matrix.ext }})
2122

2223
steps:
2324
- name: Checkout repository
24-
uses: actions/checkout@v2
25+
uses: actions/checkout@v3
2526

26-
- name: Setup PHP
27+
- name: Setup PHP ${{ matrix.php }} (${{ matrix.ext }})
2728
uses: shivammathur/setup-php@v2
2829
with:
2930
php-version: ${{ matrix.php }}
30-
extensions: curl, mbstring, openssl, gmp
31+
extensions: ${{ matrix.ext }}
3132
coverage: none
3233

33-
- name: Setup node
34-
uses: actions/setup-node@v2
35-
with:
36-
node-version: '16'
34+
- name: Get composer cache directory
35+
id: composer-cache
36+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
3737

3838
- name: Cache Composer dependencies
39-
uses: actions/cache@v2
39+
uses: actions/cache@v3
4040
with:
41-
path: /tmp/composer-cache
42-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
43-
44-
- name: Prepare composer
45-
run: |
46-
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
47-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
48-
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
41+
path: ${{ steps.composer-cache.outputs.dir }}
42+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
43+
restore-keys: ${{ runner.os }}-composer-
4944

50-
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
51-
then
52-
>&2 echo 'ERROR: Invalid installer checksum'
53-
rm composer-setup.php
54-
exit 1
55-
fi
45+
- name: Install dependencies
46+
run: composer install --prefer-dist
5647

57-
sudo php composer-setup.php --quiet --install-dir=/usr/local/bin --filename=composer
58-
RESULT=$?
59-
rm composer-setup.php
60-
composer config discard-changes true
61-
composer install
48+
- name: Setup node
49+
uses: actions/setup-node@v3
50+
with:
51+
node-version: '18'
6252

63-
- name: Setup web-push-testing-service
53+
- name: Install web-push-testing-service
6454
run: |
65-
npm install web-push-testing -g
55+
npm install -g web-push-testing
6656
67-
- name: Run tests
57+
- name: Run unit tests
6858
run: |
6959
web-push-testing --port 9012 start
7060
composer test:unit
@@ -74,5 +64,5 @@ jobs:
7464
run: composer test:typing
7565

7666
- name: Run php-cs-fixer
77-
if: ${{ matrix.php != '8.1' }}
67+
if: ${{ matrix.php != '8.2' }} # Not supported yet.
7868
run: composer test:syntax

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ As it is standardized, you don't have to worry about what server type it relies
1010

1111
## Requirements
1212

13-
PHP 7.3+ and the following extensions:
13+
PHP 8.0+ and the following extensions:
1414
* gmp (optional but better for performance)
1515
* mbstring
1616
* curl
@@ -21,6 +21,7 @@ There is no support and maintenance for older PHP versions, however you are free
2121
- PHP 7.0: `v2.x`
2222
- PHP 7.1: `v3.x-v5.x`
2323
- PHP 7.2: `v6.x`
24+
- PHP 7.3 7.4: `v7.x`
2425

2526
## Installation
2627
Use [composer](https://getcomposer.org/) to download and install the library and its dependencies.

composer.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"test:syntax": "./vendor/bin/php-cs-fixer fix ./src --dry-run --stop-on-violation --using-cache=no"
1919
},
2020
"require": {
21-
"php": ">=7.3",
21+
"php": ">=8.0",
2222
"ext-curl": "*",
2323
"ext-json": "*",
2424
"ext-mbstring": "*",
@@ -30,10 +30,13 @@
3030
"web-token/jwt-util-ecc": "^2.0|^3.0.2",
3131
"spomky-labs/base64url": "^2.0"
3232
},
33+
"suggest": {
34+
"ext-gmp": "Optional for performance."
35+
},
3336
"require-dev": {
34-
"phpunit/phpunit": "^8.0|^9.0",
35-
"phpstan/phpstan": "^0.11|^0.12",
36-
"friendsofphp/php-cs-fixer": "^2.14"
37+
"phpunit/phpunit": "^9.5.27",
38+
"phpstan/phpstan": "^1.9.8",
39+
"friendsofphp/php-cs-fixer": "^v3.13.2"
3740
},
3841
"autoload": {
3942
"psr-4" : {

src/WebPush.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,13 @@ public function __construct(array $auth = [], array $defaultOptions = [], ?int $
7272
'mbstring' => '[WebPush] mbstring extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.',
7373
'openssl' => '[WebPush] openssl extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.',
7474
];
75-
$phpVersion = phpversion();
76-
if ($phpVersion && version_compare($phpVersion, '7.3.0', '<')) {
77-
$extensions['gmp'] = '[WebPush] gmp extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.';
78-
}
75+
7976
foreach ($extensions as $extension => $message) {
8077
if (!extension_loaded($extension)) {
8178
trigger_error($message, E_USER_WARNING);
8279
}
8380
}
8481

85-
if (ini_get('mbstring.func_overload') >= 2) {
86-
trigger_error("[WebPush] mbstring.func_overload is enabled for str* functions. You must disable it if you want to send push notifications with payload or use VAPID. You can fix this in your php.ini.", E_USER_NOTICE);
87-
}
88-
8982
if (isset($auth['VAPID'])) {
9083
$auth['VAPID'] = VAPID::validate($auth['VAPID']);
9184
}

0 commit comments

Comments
 (0)