Skip to content

Commit 29ea46b

Browse files
authored
Switch static-php-cli to support PHP 8.3 and 8.4 only (#615)
* Update spc self to PHP 8.4 only * Update workflows * Fix test-extensions, adjust docs order * Fix cs-fix and phpunit * Add PHP_CS_FIXER_IGNORE_ENV * Add compatibility for PHP 8.3 * Change version description in README, adjust composer.json PHP version limit * Switch PHP to 8.4 in spc-alpine-docker * Add deprecation notice
1 parent 8a17e23 commit 29ea46b

22 files changed

+1759
-1165
lines changed

.github/workflows/build-unix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
- name: "Setup PHP"
130130
uses: shivammathur/setup-php@v2
131131
with:
132-
php-version: ${{ inputs.php-version }}
132+
php-version: 8.4
133133
tools: pecl, composer
134134
extensions: curl, openssl, mbstring
135135
ini-values: memory_limit=-1

.github/workflows/build-windows-x86_64.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
version:
77
required: true
88
description: php version to compile
9-
default: '8.2'
9+
default: '8.4'
1010
type: choice
1111
options:
1212
- '8.4'

.github/workflows/ext-matrix-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
- name: "Setup PHP"
114114
uses: shivammathur/setup-php@v2
115115
with:
116-
php-version: 8.2
116+
php-version: 8.4
117117
tools: pecl, composer
118118
extensions: curl, openssl, mbstring
119119
ini-values: memory_limit=-1

.github/workflows/release-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
workflow_dispatch:
1010

1111
env:
12-
PHP_VERSION: 8.2
13-
MICRO_VERSION: 8.2.18
12+
PHP_VERSION: 8.4
13+
MICRO_VERSION: 8.4.4
1414

1515
jobs:
1616
build-release-artifacts:

.github/workflows/tests.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ jobs:
3434
- name: "Setup PHP"
3535
uses: shivammathur/setup-php@v2
3636
with:
37-
php-version: '8.1'
37+
php-version: '8.4'
3838
extensions: curl, openssl, mbstring
3939
ini-values: memory_limit=-1
4040
tools: pecl, composer, php-cs-fixer
4141

4242
- name: Run PHP-CS-Fixer fix
43-
run: php-cs-fixer fix --dry-run --diff --ansi
43+
run: PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --dry-run --diff --ansi
4444

4545
phpstan:
4646
runs-on: ubuntu-latest
@@ -52,7 +52,7 @@ jobs:
5252
- name: "Setup PHP"
5353
uses: shivammathur/setup-php@v2
5454
with:
55-
php-version: '8.1'
55+
php-version: '8.4'
5656
extensions: curl, openssl, mbstring
5757
ini-values: memory_limit=-1
5858
tools: composer
@@ -79,9 +79,6 @@ jobs:
7979
strategy:
8080
matrix:
8181
include:
82-
- php: '8.1'
83-
- php: '8.2'
84-
- php: '8.3'
8582
- php: '8.4'
8683

8784
steps:
@@ -125,7 +122,7 @@ jobs:
125122
- name: "Setup PHP"
126123
uses: shivammathur/setup-php@v2
127124
with:
128-
php-version: 8.2
125+
php-version: 8.4
129126

130127
- name: Define
131128
id: gendef
@@ -153,7 +150,7 @@ jobs:
153150
- name: "Setup PHP"
154151
uses: shivammathur/setup-php@v2
155152
with:
156-
php-version: 8.2
153+
php-version: 8.4
157154
tools: pecl, composer
158155
extensions: curl, openssl, mbstring
159156
ini-values: memory_limit=-1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ packlib_files.txt
3232
!/bin/spc*
3333
!/bin/setup-runtime*
3434
!/bin/spc-alpine-docker
35+
!/bin/php-cs-fixer-wrapper
3536

3637
# exclude windows build tools
3738
/php-sdk-binary-tools/

.php-cs-fixer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
'php_unit_test_class_requires_covers' => false,
6565
'phpdoc_var_without_name' => false,
6666
'fully_qualified_strict_types' => false,
67+
'operator_linebreak' => false,
68+
'php_unit_data_provider_method_order' => false,
6769
])
6870
->setFinder(
6971
PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests/SPC'])

README-zh.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static-php-cli(简称 `spc`)有许多特性:
5858

5959
### 编译环境需求
6060

61-
- PHP >= 8.1(这是 spc 自身需要的版本,不是支持的构建版本)
61+
- PHP >= 8.4(这是 spc 自身需要的版本,不是支持的构建版本)
6262
- 扩展:`mbstring,tokenizer,phar`
6363
- 系统安装了 `curl``git`
6464

@@ -180,6 +180,9 @@ bin/spc --version
180180
# 检查环境依赖,并根据尝试自动安装缺失的编译工具
181181
./bin/spc doctor --auto-fix
182182

183+
# 输出目标项目依赖的扩展列表
184+
./bin/spc dump-extensions /path/to/your/project --format=text
185+
183186
# 拉取所有依赖库
184187
./bin/spc download --all
185188
# 只拉取编译指定扩展需要的所有依赖(推荐)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ which can be downloaded directly according to your needs.
6767
You can say I made a PHP builder written in PHP, pretty funny.
6868
But static-php-cli runtime only requires an environment above PHP 8.1 and extensions mentioned below.
6969

70-
- PHP >= 8.1 (This is the version required by spc itself, not the build version)
70+
- PHP >= 8.4 (This is the version required by spc itself, not the build version)
7171
- Extension: `mbstring,tokenizer,phar`
7272
- Supported OS with `curl` and `git` installed
7373

@@ -195,7 +195,7 @@ Basic usage for building php with some extensions:
195195
# fetch all libraries
196196
./bin/spc download --all
197197
# dump a list of extensions required by your project
198-
./bin/spc dump-extensions
198+
./bin/spc dump-extensions /path/to/your/project --format=text
199199
# only fetch necessary sources by needed extensions (recommended)
200200
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
201201
# download pre-built libraries first (save time for compiling dependencies)

bin/php-cs-fixer-wrapper

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
# get parent dir, and run the php-cs-fixer
4+
PHP_CS_FIXER_IGNORE_ENV=1 "$(dirname "$0")/../vendor/bin/php-cs-fixer" "$@"

0 commit comments

Comments
 (0)