1
0
mirror of https://github.com/shivammathur/setup-php.git synced 2025-04-06 11:19:26 +07:00

Compare commits

...

227 Commits
2.25.3 ... main

Author SHA1 Message Date
Shivam Mathur
42a9487ddd
Fix pdo_oci 2025-03-15 04:43:12 +05:30
Shivam Mathur
f5d98d1683
Improve support for phalcon5 and zephir_parser 2025-03-14 21:26:51 +05:30
Shivam Mathur
1a94db50cb
Update dependencies 2025-03-14 20:36:54 +05:30
Shivam Mathur
1489f576c9
Merge pull request from jg-development/main
switch to launchpadcontent  close
2025-03-14 18:16:42 +05:30
Jan Gantzert
f25b1cfdcc switch to launchpadcontent close 2025-03-14 13:31:13 +01:00
Shivam Mathur
3209251719
Merge pull request from hms5232/update-ubuntu-latest-to-24
Move `ubuntu-latest` to 24.04
2025-02-25 14:47:34 +05:30
hms5232
8ad85316fe
Move ubuntu-latest to 24.04 2025-02-25 12:57:46 +08:00
Shivam Mathur
297b3cde3c
Merge pull request from voodooism/feature/priority-for-openswoole-ext
Change openswoole priority
2025-02-18 20:02:29 +05:30
Roman Andreev
4eb1919d22 Change openswoole priority 2025-02-18 14:09:04 +01:00
Shivam Mathur
d8af2f43ce
Merge pull request from DanielEScherzer/patch-1
README: update list of PHP versions
2025-02-15 15:19:01 +05:30
DanielEScherzer
d3fead0baf
README: update list of PHP versions
PHP 8.2 is no longer in active support and only receives security fixes, see
announcement at <https://news-web.php.net/php.internals/126138>.
2025-02-14 21:14:48 -08:00
Shivam Mathur
6cd838e903
Add fallback for launchpad API 2025-02-10 16:57:17 +05:30
Shivam Mathur
3bfebc13bc
Add fallback url for phpunit tools 2025-02-07 05:40:29 +05:30
Shivam Mathur
89a5bffb0b
Improving locking process in get 2025-02-06 02:33:08 +05:30
Shivam Mathur
260b35cca0
Add support for blackfire on PHP 8.4 2025-02-01 21:27:42 +05:30
Shivam Mathur
f902cc7bd9
Update ioncube support till PHP 8.4 2025-02-01 20:59:07 +05:30
Shivam Mathur
ad03a92562
Use Markdown highlighting in README for notes 2025-02-01 08:55:51 +05:30
Shivam Mathur
a99dd2408e
Merge pull request from shivammathur/dependabot/npm_and_yarn/npm_and_yarn-2c579f9325
Bump undici from 5.28.4 to 5.28.5 in the npm_and_yarn group
2025-01-22 07:12:09 +05:30
dependabot[bot]
a7d262f1d8
Bump undici from 5.28.4 to 5.28.5 in the npm_and_yarn group
Bumps the npm_and_yarn group with 1 update: [undici](https://github.com/nodejs/undici).


Updates `undici` from 5.28.4 to 5.28.5
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.4...v5.28.5)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-22 00:45:26 +00:00
Shivam Mathur
c1750d382b
Add aarch64 ubuntu runners in OS support [skip ci] 2025-01-22 04:56:05 +05:30
Shivam Mathur
6516e9cb24
Add support for arm64 icu and intl builds 2025-01-22 04:56:05 +05:30
Shivam Mathur
783c77d669
Fix sed for macos in patch script 2025-01-22 04:56:05 +05:30
Shivam Mathur
b0064cd05b
Fix arm support for some tools and extensions [skip ci] 2025-01-22 04:56:05 +05:30
Shivam Mathur
fd913ba092
Fix composer normalize version [skip ci] 2025-01-22 04:56:05 +05:30
Shivam Mathur
21e092a3e0
Merge pull request from deguif/update-php-cs-fixer-repository
Update php-cs-fixer repository organisation
2025-01-08 17:53:40 +05:30
François-Xavier de Guillebon
64652c947d
Update php-cs-fixer repository organisation 2025-01-08 11:13:54 +01:00
Shivam Mathur
9e72090525
Fix composer-dependency-analyser packagist repository 2024-12-30 21:54:47 +05:30
Shivam Mathur
34b79cab10
Improve docs for php-version-file input 2024-12-30 21:47:27 +05:30
Shivam Mathur
e5af5d68b4
Update default version in linux.sh and darwin.sh 2024-12-30 20:17:07 +05:30
Shivam Mathur
ba21a89e0b
Pass prefix options to make in source.sh 2024-12-29 09:22:49 +05:30
Shivam Mathur
12b88cf3e2
Fix building pdo_firebird on macOS with clang 15 2024-12-29 09:17:30 +05:30
Shivam Mathur
cffd8ca58a
Fix libssl link in couchbase [skip ci] 2024-12-28 18:26:04 +05:30
Shivam Mathur
85ed51cf85
Fix support for zephir_parser 2024-12-28 18:15:07 +05:30
Shivam Mathur
5bb2eed0aa
Fix oci extension support on Windows for PHP 8.4 and above 2024-12-28 02:07:42 +05:30
Shivam Mathur
96fb539134
Bump node dependencies 2024-12-26 18:03:23 +05:30
Shivam Mathur
775fa76ea4
Do not upgrade when version is pre-installed on macOS 2024-12-23 16:27:45 +05:30
Shivam Mathur
da729085ef
Add support for pre-installed PHP 2024-12-23 16:04:30 +05:30
Shivam Mathur
b6d8115f12
Add support for .tool-versions format in php-version-file 2024-12-23 15:27:22 +05:30
Shivam Mathur
84f76b1fc9
Add support for composer files in sub-directory 2024-12-23 14:36:14 +05:30
Shivam Mathur
cdfde5ebec
Fix update on multiple installs in same job 2024-12-23 07:33:26 +05:30
Shivam Mathur
7e98140142
Add windows-2025 to the readme 2024-12-19 22:54:36 +05:30
Shivam Mathur
85a8dfd0c7
Rebuild release file 2024-12-14 03:27:47 +05:30
Shivam Mathur
7ee42db5db
Merge pull request from tillkruss/patch-2
Relay: Support PHP 8.4 and 8.5
2024-12-13 21:56:33 +00:00
Till Krüss
cdbb89961e
support 8.4 and 8.5 for relay 2024-12-13 09:24:59 -08:00
Shivam Mathur
19ba822314
Merge pull request from alexmerlin/fix-github-workflows-docs
Fixed syntax error in `.github/workflows/docs.yml`
2024-12-02 09:20:29 +00:00
alexmerlin
fb9c2a9f77 Fixed typo in GitHub workflows docs.yml
Signed-off-by: alexmerlin <alex@dotkernel.com>
2024-12-02 11:04:50 +02:00
Shivam Mathur
e7453ef93f
Merge pull request from alexmerlin/fix-readme-typo
Fixed small typo in `README.md`
2024-12-02 08:52:14 +00:00
alexmerlin
efd3a13445 Fixed small typo in README.md
Signed-off-by: alexmerlin <alex@dotkernel.com>
2024-12-02 10:18:57 +02:00
Shivam Mathur
981ce2a75a
Do not add composer in docs workflow 2024-12-01 07:14:07 +05:30
Shivam Mathur
d97b3754a8
Fix fetching libraries on old PHP on Windows 2024-12-01 06:10:56 +05:30
Shivam Mathur
edf0223f7d
Add extension type in docs workflow 2024-12-01 06:00:17 +05:30
Shivam Mathur
516490f3d1
Update versions in manifect and win32.ps1 2024-12-01 04:45:08 +05:30
Shivam Mathur
e77cdb393f
Update PHP version in README [skip ci] 2024-11-23 03:49:40 +05:30
Shivam Mathur
944fb41c67
Merge pull request from shivammathur/dependabot/github_actions/develop/codecov/codecov-action-5
Bump codecov/codecov-action from 4 to 5
2024-11-18 15:08:19 +00:00
dependabot[bot]
0830e5d434
Bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 14:43:15 +00:00
Shivam Mathur
ae95648cfc
Bump Node.js dependencies 2024-11-18 19:32:14 +05:30
Shivam Mathur
a75ffb672b
Fix status code output in get function 2024-11-12 02:20:20 +05:30
Shivam Mathur
80075aeba5
Wait in get till no processes are using the output filepath 2024-11-11 14:32:06 +05:30
Shivam Mathur
449afbcaec
Handle race condition in get on a mutli self-hosted runners setup 2024-11-11 12:53:09 +05:30
Shivam Mathur
ce2f681d22
Add macos-15 to the README 2024-11-04 10:07:31 +05:30
Shivam Mathur
cb0fc744e6
Use windows-2022 in php workflow 2024-11-04 09:56:32 +05:30
Shivam Mathur
58a6e6fb4b
Add PHP 8.5 to the workflows 2024-11-04 09:55:55 +05:30
Shivam Mathur
bf9d25532d
Improve docs workflow 2024-11-04 09:55:00 +05:30
Shivam Mathur
4662a3d03c
Add PHP 8.5 to the README 2024-11-04 09:48:51 +05:30
Shivam Mathur
e4fb5432c7
Refactor issue templates to issue forms 2024-11-04 09:43:52 +05:30
Shivam Mathur
7f1cfc01ec
Bump version to 2.32.0
Update Node.js dependencies

Migrate eslint config to a mjs file

Fix imports in tests

Bump to Node.js 20.x in workflows
2024-11-04 08:55:26 +05:30
Shivam Mathur
371ee9d086
Fix zts support on self-hosted envs 2024-11-04 08:20:56 +05:30
Shivam Mathur
51383ecefe
Fix adding debug package lists 2024-11-04 07:45:52 +05:30
Shivam Mathur
cf36231a82
Remove macos-12 from docs workflow [skip ci] 2024-10-21 06:20:59 +05:30
Shivam Mathur
9f51892bda
Drop support for macos-12 2024-09-16 21:50:26 +05:30
Shivam Mathur
53f82379e8
Merge pull request from janedbal/composer-dependency-analyser
Support composer-dependency-analyser tool
2024-07-17 03:25:37 +00:00
Jan Nedbal
24eff50574 Support composer-dependency-analyser 2024-07-15 15:14:10 +02:00
Shivam Mathur
15b611248c
Update debian version support in README 2024-07-14 07:04:11 +05:30
Shivam Mathur
6e5c13cd3c
Bump version to 2.31.2 2024-07-14 02:49:56 +05:30
Shivam Mathur
e07eecf7a4
Update Node.js dependencies 2024-07-14 02:48:56 +05:30
Shivam Mathur
57a6e91640
Test without HOMEBREW_DEVELOPER=1 2024-07-14 02:21:00 +05:30
Shivam Mathur
c541c155ee
Bump version 2.31.1
Update Node.js dependencies
2024-07-08 16:11:28 +05:30
Shivam Mathur
afff805ea3
Fix cache support for ioncube 2024-07-02 18:02:33 +05:30
Shivam Mathur
594bd591ec
Fix version regex in Add-Extension 2024-07-01 22:34:55 +05:30
Shivam Mathur
2e947f1f69
Bump version to 2.31.0
Update Node.js dependencies
2024-06-24 03:19:18 +05:30
Shivam Mathur
2a5212466c
Add fallback mirror for php PPA when launchpad is down 2024-06-24 02:56:51 +05:30
Shivam Mathur
9c28f9ba58
Fix support for phalcon on PHP 7.4 2024-06-23 18:30:14 +05:30
Shivam Mathur
b9f1db485f
Improve support for firebird 2024-06-23 18:12:47 +05:30
Shivam Mathur
588b5da142
Fix support for couchbase on Ubuntu 24.04 2024-06-23 18:12:42 +05:30
Shivam Mathur
a0edbac27b
Fix support for blackfire 2024-06-23 08:15:22 +05:30
Shivam Mathur
606ac25b84
Fix oci extension support on Ubuntu 24.04 2024-06-23 07:54:02 +05:30
Shivam Mathur
ea566b68c0
Fix support for relay 2024-06-23 07:41:47 +05:30
Shivam Mathur
4f124b97f7
Merge pull request from shivammathur/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-06-16 21:46:00 +05:30
dependabot[bot]
8fe6ba1e38
Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-16 13:17:43 +00:00
Shivam Mathur
193510cd90
Link apt-fast to apt-get if missing 2024-06-16 08:07:19 +05:30
Shivam Mathur
b5f04d97d9
Bump version to 2.30.6
Update Node.js dependencies
2024-06-16 07:39:23 +05:30
Shivam Mathur
4b56933e00
Add dkpg option to overwrite conf files 2024-06-16 07:39:18 +05:30
Shivam Mathur
fc14643b0a
Fix brew link step
We add --overwrite parameter to brew install and upgrade commands, so that in the linking step it does not fail if another php version is linked
2024-06-02 23:04:56 +05:30
Shivam Mathur
fdb0d9d1a7
Add PHP 8.3 support for zephir parser 2024-06-02 07:32:16 +05:30
Shivam Mathur
622cada40f
Bump Node.js dependencies 2024-05-28 12:43:43 +05:30
Shivam Mathur
2a620039e8
Fix priority for ev extension 2024-05-28 12:31:00 +05:30
Shivam Mathur
376a964e21
Implement ioncube support on unix correctly
I think I jumped the shark with this one for this project
2024-05-22 06:54:49 +05:30
Shivam Mathur
d6560b1fbb
Document and test support for ubuntu-24.04 2024-05-17 19:19:10 +05:30
Shivam Mathur
868f02c3ff
Improve support for deb822 system sources file 2024-04-27 21:04:56 +05:30
Shivam Mathur
18975ec414
Fix ecs config 2024-04-26 02:16:03 +05:30
Shivam Mathur
c49792fb59
Merge pull request from em411/feature/ecs-support
Add support for ecs
2024-04-26 02:03:46 +05:30
em411
806c3cc058 Add support for ecs 2024-04-25 21:59:57 +02:00
Shivam Mathur
c665c7a15b
Bump version to 2.30.4 2024-04-24 03:54:07 +05:30
Shivam Mathur
b30e4bc764
Document that only PHP 5.6 and above are supported on arm64 macos runners 2024-04-24 03:52:52 +05:30
Shivam Mathur
436881d084
Set macos version in php workflow to macos-13 2024-04-24 03:38:15 +05:30
Shivam Mathur
14d9660823
Fix support for sqlsrv and pdo_sqlsrv 2024-04-24 03:05:05 +05:30
Shivam Mathur
efffd0e4f2
Bump version to 2.30.3 2024-04-21 18:55:19 +05:30
Shivam Mathur
d802457674
Fix reading extension_dir in PHP 8.4 on macOS 2024-04-21 18:16:08 +05:30
Shivam Mathur
8872c784b0
Bump version to 2.30.2
Update Node.js dependencies
2024-03-31 03:53:16 +05:30
Shivam Mathur
b203b24815
Hotfix: update brew along with core tap 2024-03-31 03:51:38 +05:30
Shivam Mathur
116fe4df69
Add vld for macOS 2024-03-26 17:29:27 +05:30
Shivam Mathur
73963f5001
Uprade existing macOS version 2024-03-25 07:30:22 +05:30
Shivam Mathur
f4fb0af4d5
Fix phalcon5 support on Windows 2024-03-25 07:27:19 +05:30
Shivam Mathur
eb73c01f76
Fix oci extensions for PHP 8.4 2024-03-25 03:47:20 +05:30
Shivam Mathur
3d8c10397e
Fix support for sqlsrv and pdo_sqlsrv extensions 2024-03-25 03:10:43 +05:30
Shivam Mathur
db8db3c7c7
Fix type error in Get-File in win32.ps1 2024-03-25 02:42:14 +05:30
Shivam Mathur
31bfabaf56
Bump Node.js dependencies 2024-03-25 01:05:36 +05:30
Shivam Mathur
21eeae309a
Cleanup dependency code on macOS and add retry to git fetch 2024-03-18 09:02:23 +05:30
Shivam Mathur
48e0de2ea6 Update Pre-installed PHP version in Windows runners in README 2024-03-10 12:07:59 +05:30
Shivam Mathur
88841d1465 Update default PHP versions in README for GH runners 2024-03-03 07:41:03 +05:30
Shivam Mathur
a4e22b60bb Bump version to 2.30.0 2024-03-01 12:06:41 +05:30
Shivam Mathur
4f6ab99328 Sync brew core tap for all runners 2024-03-01 12:06:34 +05:30
Shivam Mathur
a870b0a9be Update README [skip ci] 2024-02-24 11:34:19 +05:30
Markus Podar
67271131b1 Update README.md
actions/cache 4 was already released
2024-02-23 02:37:15 +05:30
Shivam Mathur
a6ce3f5633 Add support to use existing COMPOSER_PROCESS_TIMEOUT 2024-02-22 12:06:24 +05:30
Shivam Mathur
1a5ac4aa9a Add more notes about debugging symbols in README [skip ci] 2024-02-22 11:25:40 +05:30
Shivam Mathur
765279d5ef
Merge pull request from shivammathur/dependabot/github_actions/develop/codecov/codecov-action-4
Bump codecov/codecov-action from 3 to 4
2024-02-05 20:19:56 -08:00
dependabot[bot]
d71d15b3b3
Bump codecov/codecov-action from 3 to 4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 10:57:17 +00:00
Shivam Mathur
ad24e86677
Merge pull request from shivammathur/dependabot/github_actions/develop/actions/cache-4
Bump actions/cache from 3 to 4
2024-01-22 15:41:53 +05:30
dependabot[bot]
73dfd2f824
Bump actions/cache from 3 to 4
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-22 10:07:33 +00:00
Shivam Mathur
6d7209f44a
Add patch for old random headers on PHP 8.4 2024-01-15 11:14:26 +05:30
Shivam Mathur
2ee6851e7b
Bump Node.js dependencies 2024-01-15 03:40:39 +05:30
Shivam Mathur
353ba41d44
Add support for phalcon on PHP 8.3 2024-01-07 01:12:10 +05:30
Shivam Mathur
5c424d6c81
Mark v1 as unsupported 2024-01-01 01:55:48 +05:30
Shivam Mathur
e927136b25
Bump Node.js dependencies
Bump version to 2.29.0
2024-01-01 01:34:06 +05:30
Shivam Mathur
35557a3770
Update coverage in install.test.ts 2024-01-01 01:31:20 +05:30
Shivam Mathur
43e870b2d0
Add highest alias as an alternative to latest 2024-01-01 01:26:40 +05:30
Shivam Mathur
dc1a77b457
Fix support for http extension on zts and debug on macOS 2023-12-26 12:46:29 +05:30
Shivam Mathur
812360879e
Add support for zts and debug extensions on macOS 2023-12-26 02:19:32 +05:30
Shivam Mathur
201dd6c1db
Add zts support on macOS 2023-12-25 03:09:27 +05:30
Shivam Mathur
97e0a9729a
Revert bumping PHP version for snapshot minimum stability. 2023-12-24 02:21:23 +05:30
Shivam Mathur
5a2bd88cb3
Try to fix docs workflow 2023-12-24 02:12:22 +05:30
Shivam Mathur
7ba520ae30
Merge pull request from shivammathur/dependabot/github_actions/develop/actions/download-artifact-4
Bump actions/download-artifact from 3 to 4
2023-12-18 16:53:51 +05:30
Shivam Mathur
f47a6e7ca3
Merge pull request from shivammathur/dependabot/github_actions/develop/actions/upload-artifact-4
Bump actions/upload-artifact from 3 to 4
2023-12-18 16:53:40 +05:30
Shivam Mathur
e1c6cff579
Merge pull request from shivammathur/dependabot/github_actions/develop/github/codeql-action-3
Bump github/codeql-action from 2 to 3
2023-12-18 16:53:09 +05:30
dependabot[bot]
6e825ca69e
Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 10:33:19 +00:00
dependabot[bot]
7b1eaadfbb
Bump actions/download-artifact from 3 to 4
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 10:33:16 +00:00
dependabot[bot]
5b709ff10e
Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 10:33:13 +00:00
Shivam Mathur
ed98159fe9
Fix PHP 8.3 support status in README. Closes 2023-12-14 18:50:41 +05:30
Shivam Mathur
58f08c5f7c
Add box and php-scoper in tools support in README 2023-12-14 16:38:02 +05:30
Shivam Mathur
9e24ffafe7
Merge pull request from davereid/patch-2
Document php-version can come from platform overrides in composer.lock or composer.json
2023-12-08 08:02:43 +05:30
Dave Reid
5eca5d1c47
Update README.md 2023-12-07 16:02:03 -06:00
Shivam Mathur
c085ca391e
Merge pull request from davereid/patch-1
Provide a "lowest" php-version parameter
2023-12-08 00:14:49 +05:30
Dave Reid
93745da978 Updated files after npm run build. 2023-12-07 12:23:09 -06:00
Dave Reid
c088c0cfeb
Document php-version can come from platform overrides in composer.lock and composer.json 2023-12-07 10:53:24 -06:00
Dave Reid
86b90110cb
Update php.yml 2023-12-07 10:46:39 -06:00
Dave Reid
1a102bc9f2
Update utils.ts 2023-12-07 09:44:35 -06:00
Shivam Mathur
131ba03b0d
Fix phalcon support 2023-12-07 08:15:34 +05:30
Shivam Mathur
e8cd65f444
Switch to PHPCSStandards/PHP_CodeSniffer for phpcs and phpcbf 2023-12-04 08:00:30 +05:30
Dave Reid
2810265746
Update php.yml 2023-11-30 09:53:39 -06:00
Dave Reid
dab726e922
Provide a "lowest" php-version parameter 2023-11-29 20:26:11 -06:00
Shivam Mathur
e6f75134d3
Update phpts section in README 2023-11-27 18:07:02 +05:30
Shivam Mathur
1874353919
Fix linking grpc on macos but installed along protoc 2023-11-27 17:08:32 +05:30
Shivam Mathur
eea39ea741
Disable xdebug and pcov when blackfire extension is installed 2023-11-27 16:39:18 +05:30
Shivam Mathur
bac56c8d91
Add patch for geos 2023-11-27 15:47:27 +05:30
Shivam Mathur
124d256c78
Add back support for nightly builds on self-hosted 2023-11-27 14:52:14 +05:30
Shivam Mathur
eeddcfe955
Bump version to 2.28.0
Update Node.js dependencies
2023-11-27 13:57:32 +05:30
Shivam Mathur
de2903ad82
Fix installing zts builds 2023-11-26 03:55:45 +05:30
Shivam Mathur
bbe1204148
Use cached builds for zts 2023-11-26 03:34:57 +05:30
Shivam Mathur
99a92d54d5
Test cache for PHP 8.3 and PHP 8.4 2023-11-24 01:06:24 +05:30
Shivam Mathur
7c6c249257
Mark PHP 8.3 as stable 2023-11-23 17:12:56 +05:30
Shivam Mathur
e6d44f159a
Add PHP 8.4 to wiki extension pages 2023-11-23 12:12:26 +05:30
Shivam Mathur
dc513528da
Update os in docs workflow 2023-11-23 11:57:50 +05:30
Shivam Mathur
bfbd3882c0
Merge pull request from jrfnl/feature/ghactions-update-for-php-8.3
GH Actions/docs workflow: generate extensions page for PHP 8.3
2023-11-22 20:37:08 -08:00
jrfnl
3c525df325
GH Actions/docs workflow: generate extensions page for PHP 8.3 2023-11-23 03:19:38 +01:00
Shivam Mathur
a36e1e52ff
Bump version to 2.27.1
Bump Node.js dependencies
2023-11-07 13:55:37 +05:30
Shivam Mathur
04ff9b08a2
Add HOMEBREW_NO_INSTALL_FROM_API=1 to darwin.sh 2023-11-07 13:43:28 +05:30
Shivam Mathur
65fad67e88
Fix updating homebrew dependencies after sharding in core tap 2023-11-07 13:11:56 +05:30
Shivam Mathur
6668249e24
Merge pull request from shivammathur/dependabot/github_actions/develop/actions/setup-node-4
Bump actions/setup-node from 3 to 4
2023-11-06 04:04:01 -08:00
dependabot[bot]
81c255f988
Bump actions/setup-node from 3 to 4
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-06 11:00:34 +00:00
Shivam Mathur
81cd5ae092
Bump version to 2.27.0 2023-11-01 19:56:15 +05:30
Shivam Mathur
29a9813921
Add required extensions for box 2023-11-01 10:23:55 +05:30
Shivam Mathur
f60e7de98e
Add PHP 8.4 to the php workflow
Enable PHP 8.3 for macOS in the php workflow
2023-11-01 09:35:10 +05:30
Shivam Mathur
b5efb21934
Add tests for box and php-scoper 2023-11-01 09:29:02 +05:30
Shivam Mathur
26e6a92f3b
Merge pull request from theofidry/patch-1
feat: Add Box and PHP-Scoper as tools
2023-11-01 08:53:26 +05:30
Théo FIDRY
28b68529b5
feat: Add Box and PHP-Scoper as tools 2023-11-01 08:53:26 +05:30
Shivam Mathur
4e4861ec30
Fix support for couchbase on PHP 7.4 2023-10-30 08:11:09 +05:30
Shivam Mathur
70169700c3
Try to improve couchbase compilation 2023-10-30 06:58:16 +05:30
Shivam Mathur
f4e27c9ead
Bump Node.js dependencies
Bump version to 2.26.1
2023-10-30 01:47:34 +05:30
Shivam Mathur
9855c76987
Set keepAlive to false. After Node 19 it is true by default. 2023-10-30 01:38:35 +05:30
Shivam Mathur
546935924a
Merge pull request from shivammathur/dependabot/npm_and_yarn/babel/traverse-7.23.2
Bump @babel/traverse from 7.22.5 to 7.23.2
2023-10-19 16:04:25 +05:30
dependabot[bot]
491e9de600
Bump @babel/traverse from 7.22.5 to 7.23.2
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.5 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-19 09:40:39 +00:00
Shivam Mathur
e3bda5bed8
Add support for macOS Sonoma (14) and drop support for Big Sur (11) 2023-10-01 19:03:17 +05:30
Shivam Mathur
e70f6d9e7c
Fallback to pecl in add_brew_extension on macOS 2023-10-01 18:49:44 +05:30
Shivam Mathur
92e992b198
Update versioning section in the README 2023-09-23 04:32:24 +05:30
Shivam Mathur
99680be1df
Rename branch in README 2023-09-23 03:29:31 +05:30
Shivam Mathur
e83e329355
Fix find call in darwin.sh in copy_brew_extensions on failure 2023-09-22 14:07:12 +05:30
Shivam Mathur
10c12b9377
Fix checking for existing php formula on macOS 2023-09-22 14:00:55 +05:30
Shivam Mathur
91026460e4
Create tool_path_dir if it does not exist 2023-09-22 08:15:57 +05:30
Shivam Mathur
7fdd3ece87
Fix blackfire-player on Linux and macOS
Drop support for blackfire-player on Windows
2023-09-14 02:51:49 +05:30
Shivam Mathur
0de5aa9140
Bump version to 2.26.0 2023-09-14 02:51:49 +05:30
Shivam Mathur
a6e0b1404f
Bump Node.js dependencies 2023-09-14 02:51:48 +05:30
Shivam Mathur
5d259c66b1
Bump node version to 20 in action.yml
Node 16 is EOL on 2023-09-11 so we update it to Node 20 that was added in the actions/runner in v2.308.0
2023-09-14 02:51:48 +05:30
Shivam Mathur
6207829361
Update use of actions/checkout to v4 2023-09-14 02:51:47 +05:30
Shivam Mathur
319feb83c2
Add support to install sqlsrv and pdo_sqlsrv from GitHub releases 2023-09-14 02:51:41 +05:30
Shivam Mathur
661ad4bf75
Fix enabling latest pecl extensions 2023-09-09 08:53:07 +05:30
Shivam Mathur
04c15e2314
Remove hardcoded latest version for sqlsrv and pdo_sqlsrv 2023-09-09 08:05:42 +05:30
Shivam Mathur
5aa416d77b
Merge pull request from GrahamCampbell/patch-1
Use sqlsvr 5.11.1 on PHP 8
2023-09-09 07:18:11 +05:30
Graham Campbell
a9a661ccd4
Use sqlsvr 5.11.1 on PHP 8 2023-09-09 00:45:36 +01:00
Shivam Mathur
321f8d7d9a
Add PHP 8.4 in the README 2023-08-30 15:15:56 +05:30
Shivam Mathur
7af6c0fe6f
Update Node.js dependencies 2023-08-30 15:15:56 +05:30
Shivam Mathur
36e04fc85c
Merge pull request from jasongill/develop
Add automatic detection of required PHP version from Composer's platform setting
2023-07-30 08:50:55 +05:30
Jason Gill
95916a72b1 Only use config.platform.php, as it's guaranteed to be the required version of PHP 2023-07-29 19:48:28 -04:00
Jason Gill
a5fb328c6a Add support for reading PHP version from composer.lock or composer.json 2023-07-29 19:46:06 -04:00
Shivam Mathur
72ae4ccbe5
Update Node.js dependenices
Remove semver override

Bump version to 2.25.5
2023-07-29 22:03:23 +05:30
Shivam Mathur
5b2015e8fe
Link opcache to ext_dir on macOS 2023-07-29 21:45:53 +05:30
Shivam Mathur
9c77701ae5
Remove workaround of Debian 12 in ppa.sh 2023-07-03 07:38:22 +05:30
Shivam Mathur
394503cb8a
Override semver version to 7.5.3 GHSA-c2qf-rxjj-qqgw/CVE-2022-25883 2023-07-02 02:34:06 +05:30
Shivam Mathur
f1cc14e3d5
Fix grep call in ppa.sh
When distros use DEB822-STYLE .sources file or a custom default list file the list_file is not present, so we check if it exists before calling grep on it
2023-07-02 02:16:13 +05:30
Shivam Mathur
9d529a72e0
Only check castor version if castor.php is present 2023-06-24 02:25:43 +05:30
Shivam Mathur
c63f07d82e
Fix version prefix for castor 2023-06-23 23:28:05 +05:30
Shivam Mathur
e40aa32c04
Update Node.js dependencies 2023-06-23 23:23:33 +05:30
Shivam Mathur
a683e80307
Merge pull request from pyrech/support-castor
Add support for tool jolicode/castor
2023-06-23 22:59:01 +05:30
Loïck Piera
7ce22e0264
Add support for jolicode/castor 2023-06-23 16:13:17 +02:00
Shivam Mathur
4bd44f22a9
Bump version to 2.25.4
Update Node.js dependencies
2023-06-13 03:25:48 +05:30
Shivam Mathur
d2f333de6f
Fix regression in major/minor.major version support for phpunit 2023-06-13 03:16:19 +05:30
Shivam Mathur
948bd8df3c
Fix fs import in utlts.test.ts 2023-06-12 17:14:07 +05:30
90 changed files with 4331 additions and 12207 deletions

@ -1,16 +0,0 @@
{
"env": { "node": true, "jest": true },
"parser": "@typescript-eslint/parser",
"parserOptions": { "ecmaVersion": 2021, "sourceType": "module" },
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
"prettier"
],
"plugins": ["@typescript-eslint", "jest"]
}

@ -1,42 +0,0 @@
---
name: Bug report
about: Nice, you found a bug!
title: ''
labels: 'bug'
assignees: 'shivammathur'
---
**Describe the bug**
<!-- Please describe the bug concisely. -->
**Version**
- [ ] I have checked releases, and the bug exists in the latest patch version of `v1` or `v2`.
- [ ] `v2`
- [ ] `v1`
**Runners**
<!-- Please mark the GitHub Action runner your workflow uses. -->
- [ ] GitHub Hosted
- [ ] Self Hosted
**Operating systems**
<!-- Please mention the operating systems your workflow uses. -->
**PHP versions**
<!-- Please mention the PHP versions your workflow uses. -->
**To Reproduce**
<!-- Please provide the relevant steps of your workflow `.yml` file. -->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Screenshots/Logs**
<!-- If applicable, add screenshots or logs to help explain your problem. -->
**Additional context**
<!-- Add any other context about the problem here. -->
**Are you willing to submit a PR?**
<!-- We accept pull requests targeting the develop branch. -->

94
.github/ISSUE_TEMPLATE/bug.yml vendored Normal file

@ -0,0 +1,94 @@
name: Bug report
description: Nice, you found a bug!
title: "Bug: "
labels: ["bug"]
assignees: ["shivammathur"]
body:
- type: markdown
attributes:
value: "Please fill out the sections below to help us address your issue."
- type: textarea
id: bug-description
attributes:
label: "Describe the bug"
placeholder: "Please describe the bug concisely."
validations:
required: true
- type: checkboxes
id: version
attributes:
label: "Version"
description: "I have checked releases, and the bug exists in the latest patch version of `v1` or `v2`."
options:
- label: "v2"
- label: "v1"
validations:
required: true
- type: dropdown
id: runners
attributes:
label: "Runners"
description: "Please choose the GitHub Action runner your workflow uses."
options:
- "GitHub Hosted"
- "Self Hosted"
validations:
required: true
- type: textarea
id: operating-systems
attributes:
label: "Operating systems"
placeholder: "e.g., Ubuntu 20.04, Windows Server 2019, etc."
validations:
required: true
- type: textarea
id: php-versions
attributes:
label: "PHP versions"
placeholder: "e.g., PHP 7.4, PHP 8.0, etc."
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: "To Reproduce"
placeholder: "Please provide the relevant steps of your workflow `.yml` file."
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: "Expected behavior"
placeholder: "A clear and concise description of what you expected to happen."
validations:
required: true
- type: textarea
id: screenshots-logs
attributes:
label: "Screenshots/Logs"
placeholder: "Drag and drop images or paste logs here..."
- type: textarea
id: additional-context
attributes:
label: "Additional context"
placeholder: "Add any other context about the problem here."
- type: dropdown
id: willing-to-submit-pr
attributes:
label: "Are you willing to submit a PR?"
description: "We accept pull requests targeting the develop branch."
options:
- "Yes"
- "No"
validations:
required: true

@ -1,26 +0,0 @@
---
name: Feature request
about: Suggest a new feature
title: ''
labels: 'enhancement'
assignees: 'shivammathur'
---
**Describe the feature**
<!-- Please describe concisely the feature you want to add. -->
**Version**
- [ ] I have checked releases, and the feature is missing in the latest patch version of `v2`.
**Underlying issue**
<!-- Please describe the issue this would solve. -->
**Describe alternatives**
<!-- Please mention any alternative solutions you've considered. -->
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
**Are you willing to submit a PR?**
<!-- We accept pull requests targeting the develop branch. -->

58
.github/ISSUE_TEMPLATE/feature.yml vendored Normal file

@ -0,0 +1,58 @@
name: Feature request
description: Suggest a new feature
title: "Feature: "
labels: ["enhancement"]
assignees: ["shivammathur"]
body:
- type: markdown
attributes:
value: "Please fill out the sections below to help us understand your new feature proposal."
- type: textarea
id: feature-description
attributes:
label: "Describe the feature"
placeholder: "A clear and concise description of what you want and why."
validations:
required: true
- type: checkboxes
id: version-check
attributes:
label: "Please check the latest release"
options:
- label: "I have checked releases, and the feature is missing in the latest patch version of `v2`."
required: true
- type: textarea
id: underlying-issue
attributes:
label: "Underlying issue"
placeholder: "Please describe the issue this would solve."
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: "Describe alternatives"
placeholder: "Please mention any alternative solutions you've considered."
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: "Additional context"
placeholder: "Drag and drop images or paste any additional information here..."
- type: dropdown
id: willing-to-submit-pr
attributes:
label: "Are you willing to submit a PR?"
description: "We accept pull requests targeting the develop branch."
options:
- "Yes"
- "No"
validations:
required: true

3
.github/SECURITY.md vendored

@ -10,10 +10,9 @@ This security policy only applies to the latest patches of the following PHP ver
| Version | Supported |
|---------|--------------------|
| 7.4 | :white_check_mark: |
| 8.0 | :white_check_mark: |
| 8.1 | :white_check_mark: |
| 8.2 | :white_check_mark: |
| 8.3 | :white_check_mark: |
## Reporting a Vulnerability

@ -15,18 +15,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
config-file: ./.github/codeql/codeql-configuration.yml
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

@ -15,14 +15,35 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2022, macos-11]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
operating-system: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-2022, macos-13]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Create for Linux and macOS
tools: none
- name: Create file with all extensions for Linux and macOS
env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }}
if: matrix.operating-system != 'windows-2022'
run: |
php -m >> "$file.all"
- name: Create file with all extensions for Windows
env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }}
if: matrix.operating-system == 'windows-2022'
run: |
php -m | Out-File -FilePath "$env:file.all" -Append
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: none
tools: none
- name: Create final file for Linux and macOS
env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }}
@ -31,10 +52,20 @@ jobs:
echo "## PHP $version" >> "$file"
printf "\n" >> "$file"
echo "\`\`\`" >> "$file"
php -m >> "$file"
php -m >> "$file.builtin"
while IFS= read -r line; do
if [[ $line == [* || -z "${line// }" ]]; then
echo "$line" >> "$file"
elif grep -q "^$line" "$file.builtin"; then
echo "$line (builtin)" >> "$file"
else
echo "$line (shared)" >> "$file"
fi
done < "$file.all"
echo "\`\`\`" >> "$file"
printf "\n" >> "$file"
- name: Create for Windows
rm "$file.all" "$file.builtin"
- name: Create final file for Windows
env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }}
@ -42,12 +73,23 @@ jobs:
run: |
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
php -m | Out-File -FilePath "$env:file" -Append
php -m | Out-File -FilePath "$env:file.builtin" -Append
Get-Content "$env:file.all" | ForEach-Object {
if ($_.startsWith('[') -or -not $_.trim()) {
Write-Output "$_" | Out-File -FilePath "$env:file" -Append
} elseif ($_ -in (Get-Content "$env:file.builtin")) {
Write-Output "$_ (builtin)" | Out-File -FilePath "$env:file" -Append
} else {
Write-Output "$_ (shared)" | Out-File -FilePath "$env:file" -Append
}
}
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
Remove-Item "$env:file.all" -Force
Remove-Item "$env:file.builtin" -Force
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: lists
name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
update:
permissions:
@ -57,25 +99,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}.wiki
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
path: ${{ github.workspace }}/lists
pattern: lists-*
merge-multiple: true
- name: Configure Git
run : |
git config --local user.email "${{ secrets.email }}"
git config --local user.name "${{ github.repository_owner }}"
- name: Combine
run: |
for os in ubuntu-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-11 macos-10.15; do
for os in ubuntu-24.04 ubuntu-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-13 macos-14 macos-15; do
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2; do
if [ "$os" = "macos-10.15" ]; then
cat lists/php"$version"-macos-11.md >> Php-extensions-loaded-on-"$os".md
elif [ "$os" = "windows-2019" ]; then
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5; do
if [[ "${os%-*}" = "macos" ]]; then
cat lists/php"$version"-macos-13.md >> Php-extensions-loaded-on-"$os".md
elif [ "${os%-*}" = "windows" ]; then
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
else
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md

@ -29,14 +29,14 @@ jobs:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: Install dependencies
run: npm install
@ -54,7 +54,7 @@ jobs:
run: npm audit
- name: Send Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info

@ -28,21 +28,18 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2019, macos-latest]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
operating-system: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-2022, macos-13]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
include:
- operating-system: ubuntu-22.04
- operating-system: ubuntu-24.04
php-versions: ''
php-version-file: 'php-version-file'
exclude:
- operating-system: macos-latest
php-versions: '8.3'
env:
extensions: xml, opcache, xdebug, pcov, gd
key: cache-v5
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup cache environment
id: cache-env
@ -53,7 +50,7 @@ jobs:
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
@ -93,4 +90,4 @@ jobs:
php -r "if(ini_get('memory_limit')!='-1') {throw new Exception('memory_limit not disabled');}"
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"

@ -19,18 +19,18 @@ jobs:
steps:
- name: Checkout release
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout tag
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
ref: ${{ github.event.inputs.tag }}
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '20.x'
registry-url: https://registry.npmjs.org
- name: Install dependencies and add lib
@ -46,7 +46,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Change to GitHub Packages registry
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
registry-url: https://npm.pkg.github.com
scope: '@shivammathur'

268
README.md

@ -9,17 +9,14 @@
<p align="center">
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></a>
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.3-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
<a href="https://github.com/shivammathur/setup-php/blob/main/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.5-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
</p>
<p align="center">
<a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a>
<a href="https://twitter.com/setup_php" title="setup-php twitter"><img alt="setup-php twitter" src="https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555"></a>
<a href="https://status.setup-php.com" title="setup-php status"><img alt="setup-php status" src="https://img.shields.io/badge/status-subscribe-28A745?logo=statuspage&logoColor=28A745&labelColor=555555"></a>
</p>
<p align="center">
<a href="https://setup-php.com/support-ukraine" title="#StandWithUkraine"><img alt="#StandWithUkraine" src="https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg"></a>
</p>
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross-platform interface to set up the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
@ -71,28 +68,34 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
### GitHub-Hosted Runners
| Virtual environment | YAML workflow label | Pre-installed PHP |
|---------------------|------------------------------------|------------------------|
| Ubuntu 22.04 | `ubuntu-latest` or `ubuntu-22.04` | `PHP 8.1` |
| Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.2` |
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.2` |
| Windows Server 2019 | `windows-2019` | `PHP 8.2` |
| macOS Monterey 12.x | `macos-12` | `PHP 8.2` |
| macOS Big Sur 11.x | `macos-latest` or `macos-11` | `PHP 8.2` |
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|---------------------|---------|------------------------------------|------------------------|
| Ubuntu 24.04 | x86_64 | `ubuntu-latest` or `ubuntu-24.04` | `PHP 8.3` |
| Ubuntu 22.04 | x86_64 | `ubuntu-22.04` | `PHP 8.1` |
| Ubuntu 20.04 | x86_64 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.3` |
| Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
| Ubuntu 22.04 | aarch64 | `ubuntu-22.04-arm` | `PHP 8.1` |
| Windows Server 2025 | x64 | `windows-2025` | `PHP 8.3` |
| Windows Server 2022 | x64 | `windows-latest` or `windows-2022` | `PHP 8.3` |
| Windows Server 2019 | x64 | `windows-2019` | `PHP 8.3` |
| macOS Sequoia 15.x | arm64 | `macos-15` | - |
| macOS Sonoma 14.x | arm64 | `macos-latest` or `macos-14` | - |
| macOS Ventura 13.x | x86_64 | `macos-13` | `PHP 8.3` |
### Self-Hosted Runners
| Host OS/Virtual environment | YAML workflow label |
|----------------------------------|----------------------------|
| Ubuntu 24.04 | `self-hosted` or `Linux` |
| Ubuntu 22.04 | `self-hosted` or `Linux` |
| Ubuntu 20.04 | `self-hosted` or `Linux` |
| Debian 12 | `self-hosted` or `Linux` |
| Debian 11 | `self-hosted` or `Linux` |
| Debian 10 | `self-hosted` or `Linux` |
| Windows 7 and newer | `self-hosted` or `Windows` |
| Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
| macOS Sequoia 15.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Sonoma 14.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Ventura 13.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Monterey 12.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Big Sur 11.x x86_64/arm64 | `self-hosted` or `macOS` |
- Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
- Operating systems based on the above Ubuntu and Debian versions are also supported on best effort basis.
@ -102,8 +105,9 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
On all supported OS/Platforms the following PHP versions can be set up as per the runner.
- PHP 5.3 to PHP 8.3 on GitHub-hosted runners.
- PHP 5.6 to PHP 8.3 on self-hosted runners.
- PHP 5.3 to PHP 8.5 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
- PHP 5.6 to PHP 8.5 on GitHub-hosted macOS ARM64 runners (macos-14).
- PHP 5.6 to PHP 8.5 on self-hosted runners.
| PHP Version | Stability | Release Support | Runner Support |
|-------------|-----------|-----------------------|--------------------------------|
@ -116,14 +120,17 @@ On all supported OS/Platforms the following PHP versions can be set up as per th
| `7.2` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `7.3` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `7.4` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `8.0` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
| `8.1` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.2` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.3` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
| `8.0` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `8.1` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
| `8.2` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
| `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.5` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
**Notes:**
- Specifying `8.3` in `php-version` input installs a nightly build of `PHP 8.3.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
- To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
> [!Note]
> - Specifying `8.5` in `php-version` input installs a nightly build of `PHP 8.5.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
> - To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
## :heavy_plus_sign: PHP Extension Support
@ -135,7 +142,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
extensions: imagick, swoole
```
@ -163,7 +170,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with pre-release PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
extensions: xdebug-beta
```
@ -175,19 +182,19 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP and disable opcache
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
extensions: :opcache
```
- All shared extensions can be disabled by specifying `none`. When `none` is specified along with other extensions, it is hoisted to the start of the input. So, all the shared extensions will be disabled first, then rest of the extensions in the input will be processed.
**Note:** This disables all core and third-party shared extensions and thus, can break some tools which need them. Required extensions are enabled again when the tools are set up on a best-effort basis. So it is recommended to add the extensions required for your tools after `none` in the `extensions` input to avoid any issues.
This disables all core and third-party shared extensions and thus, can break some tools which need them. Required extensions are enabled again when the tools are set up on a best-effort basis. So it is recommended to add the extensions required for your tools after `none` in the `extensions` input to avoid any issues.
```yaml
- name: Setup PHP without any shared extensions except mbstring
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
extensions: none, mbstring
```
@ -197,7 +204,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with intl
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
extensions: intl-70.1
```
@ -214,7 +221,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
extensions: oci8
env:
fail-fast: true
@ -224,13 +231,13 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
[`behat`], [`blackfire`], [`blackfire-player`], [`churn`], [`codeception`], [`composer`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
[`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
```yaml
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: php-cs-fixer, phpunit
```
@ -240,18 +247,18 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: vimeo/psalm
```
- To set up a particular version of a tool, specify it in the form `tool:version`.
Version can be in the following format:
- Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
- Major version. For example `tool:1` or `tool:1.x`.
- Major and minor version. For example `tool:1.2` or `tool:1.2.x`.
When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
- Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
- Major version. For example `tool:1` or `tool:1.x`.
- Major and minor version. For example `tool:1.2` or `tool:1.2.x`.
When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
With the exception of major versions of `composer`, if you specify only the `major` version or the version in `major.minor` format for a tool you can get rate limited by GitHub's API. To avoid this, it is recommended to provide a [`GitHub` OAuth token](https://github.com/shivammathur/setup-php#composer-github-oauth "Composer GitHub OAuth").
You can do that by setting `GITHUB_TOKEN` environment variable. The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
@ -260,8 +267,8 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: php-cs-fixer:3.5, phpunit:9.5
php-version: '8.4'
tools: php-cs-fixer:3.64, phpunit:11.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
@ -272,7 +279,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: composer:v2
```
@ -282,7 +289,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP without composer
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: none
```
@ -298,17 +305,27 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: deployer
env:
fail-fast: true
```
**Notes**
- Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
- If you do not want to use all your dev-dependencies in workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
- By default, `COMPOSER_NO_INTERACTION` is set to `1` and `COMPOSER_PROCESS_TIMEOUT` is set to `0`. In effect, this means that Composer commands in your scripts do not need to specify `--no-interaction`.
- Also, `COMPOSER_NO_AUDIT` is set to `1`. So if you want to audit your dependencies for security vulnerabilities, it is recommended to add a `composer audit` step before you install them.
> [!NOTE]
> - Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
> - If you do not want to use all your dev-dependencies in workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
> - By default, `COMPOSER_NO_INTERACTION` is set to `1` and `COMPOSER_PROCESS_TIMEOUT` is set to `0`. In effect, this means that Composer commands in your scripts do not need to specify `--no-interaction`.
> - Also, `COMPOSER_NO_AUDIT` is set to `1`. So if you want to audit your dependencies for security vulnerabilities, it is recommended to add a `composer audit` step before you install them.
> - If you want to set a different `COMPOSER_PROCESS_TIMEOUT`, you can set it in your workflow file using the `env` keyword.
```yaml
- name: Setup PHP with composer and custom process timeout
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
env:
COMPOSER_PROCESS_TIMEOUT: 300
```
## :signal_strength: Coverage Support
@ -321,7 +338,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
coverage: xdebug
```
@ -336,25 +353,26 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
coverage: xdebug2
```
**Note**: Xdebug is enabled by default on Ubuntu GitHub Actions images, so if you are not using it in your workflow it is recommended to disable it as that will have a positive impact on your PHP performance. Please refer to the [disable coverage](#disable-coverage) section for details.
> [!NOTE]
> Xdebug is enabled by default on Ubuntu GitHub Actions images, so if you are not using it in your workflow it is recommended to disable it as that will have a positive impact on your PHP performance. Please refer to the [disable coverage](#disable-coverage) section for details.
### PCOV
Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
Runs on PHP 7.1 and newer PHP versions.
- If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
- If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
```yaml
- name: Setup PHP with PCOV
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
ini-values: pcov.directory=api #optional, see above for usage.
coverage: pcov
```
- PHPUnit 8.x and above supports PCOV out of the box.
- PHPUnit 8.x and above supports PCOV out of the box.
- If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up `pcov/clobber` before executing your tests.
```yaml
@ -379,7 +397,7 @@ Disable coverage for these reasons:
- name: Setup PHP with no coverage driver
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
coverage: none
```
@ -392,12 +410,18 @@ Disable coverage for these reasons:
#### `php-version` (optional)
- Specify the PHP version you want to set up.
- Accepts a `string`. For example `'8.0'`.
- Accepts `latest` to set up the latest stable PHP version.
- Accepts a `string`. For example `'8.4'`.
- Accepts `lowest` to set up the lowest supported PHP version.
- Accepts `highest` or `latest` to set up the latest stable PHP version.
- Accepts `nightly` to set up a nightly build from the master branch of PHP.
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
- Accepts `pre-installed` to set up the highest pre-installed PHP version. You can combine this with `update: true` to update the pre-installed PHP version.
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
- See [PHP support](#tada-php-support) for the supported PHP versions.
- If not specified, it looks for `php-version-file` input.
- If not specified, it looks for the following in order:
- The `php-version-file` input if it exists
- A `composer.lock` file and the `platform-overrides.php` value
- A `composer.json` file and the `config.platform.php` value
- If the `composer.lock` or `composer.json` file is in a sub-directory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
#### `php-version-file` (optional)
@ -405,6 +429,7 @@ Disable coverage for these reasons:
- Accepts a `string`. For example `'.phpenv-version'`.
- See [PHP support](#tada-php-support) for the supported PHP versions.
- By default, `.php-version` file is used.
- The file either have the PHP version as its content, or follow the asdf `.tool-versions` format.
- If not specified and the default `.php-version` file is not found, the latest stable PHP version is set up.
#### `extensions` (optional)
@ -423,9 +448,9 @@ Disable coverage for these reasons:
#### `ini-values` (optional)
- Specify the values you want to add to `php.ini`.
- Specify the values you want to add to `php.ini`.
- Accepts a `string` in csv-format. For example `post_max_size=256M, max_execution_time=180`.
- Accepts ini values with commas if wrapped in quotes. For example `xdebug.mode="develop,coverage"`.
- Accepts ini values with commas if wrapped in quotes. For example `xdebug.mode="develop,coverage"`.
#### `coverage` (optional)
@ -452,7 +477,7 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
- name: Print PHP version
run: echo ${{ steps.setup-php.outputs.php-version }}
@ -471,8 +496,8 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
#### `phpts` (optional)
- Specify to set up a thread-safe build of PHP on Linux and Windows.
- Accepts `ts` and `nts`.
- Specify to set up a thread-safe build of PHP.
- Accepts `nts` for non-thread-safe and `zts` or `ts` for thread-safe.
- By default, it is set to `nts`.
- See [thread safe setup](#thread-safe-setup) for more info.
@ -494,7 +519,7 @@ steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
@ -512,12 +537,12 @@ jobs:
strategy:
matrix:
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.2', '8.3', '8.4']
phpunit-versions: ['latest']
include:
- operating-system: 'ubuntu-latest'
php-versions: '8.0'
phpunit-versions: 9
php-versions: '8.1'
phpunit-versions: 10
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
@ -533,9 +558,9 @@ jobs:
### Nightly Build Setup
> Set up a nightly build of `PHP 8.3`.
> Set up a nightly build of `PHP 8.5`.
- This PHP version is currently in active development and might contain bugs and breaking changes.
- These PHP versions are currently in active development and might contain bugs and breaking changes.
- Some user space extensions might not support this version currently.
```yaml
@ -543,7 +568,7 @@ steps:
- name: Setup nightly PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.5'
extensions: mbstring
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
@ -557,34 +582,37 @@ steps:
- Production release builds of PHP without debugging symbols are set up by default.
- You can use the `debug` environment variable to set up a build with debugging symbols for PHP 5.6 and above.
> [!NOTE]
> - On Linux, the debug symbols are added as [debug info files](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html) in the `/usr/lib/debug/.build-id` directory. These files match the `build-id` in the ELF section of the PHP binaries and debugging tools like `gdb` are able to resolve the symbols from these files.
> - On Windows, the debug symbols are added as `pdb` files in the PHP installation directory.
> - On macOS, the debug symbols are compiled into the binaries.
```yaml
steps:
- name: Setup PHP with debugging symbols
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
env:
debug: true # specify true or false
```
### Thread Safe Setup
> Set up `TS` or `NTS` PHP on `Linux` and `Windows`.
> Set up `TS` or `NTS` PHP.
- `NTS` versions are set up by default.
- On `macOS` only `NTS` versions are supported currently.
- On `Linux` and `Windows` both `TS` and `NTS` versions are supported.
```yaml
jobs:
run:
runs-on: [ubuntu-latest, windows-latest]
runs-on: [ubuntu-latest, windows-latest, macos-latest]
name: Setup PHP TS
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
env:
phpts: ts # specify ts or nts
```
@ -601,7 +629,7 @@ jobs:
- name: Setup PHP with latest versions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
env:
update: true # specify true or false
```
@ -616,14 +644,14 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
- name: Setup PHP with logs
uses: shivammathur/setup-php@verbose
with:
php-version: '8.2'
php-version: '8.4'
```
### Multi-Arch Setup
> Set up PHP on multiple architecture on Ubuntu GitHub Runners.
- `PHP 5.6` to `PHP 8.2` are supported by `setup-php` on multiple architecture on `Ubuntu`.
- `PHP 5.6` to `PHP 8.4` are supported by `setup-php` on multiple architecture on `Ubuntu`.
- For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` installed for `setup-php`.
- Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup).
@ -639,7 +667,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
```
### Self Hosted Setup
@ -661,7 +689,7 @@ jobs:
runs-on: self-hosted
strategy:
matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
name: PHP ${{ matrix.php-versions }}
steps:
- name: Setup PHP
@ -672,10 +700,10 @@ jobs:
runner: self-hosted
```
**Notes**
- Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
- Do not set up self-hosted runners on the side on your development environment or your production server.
- Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
> [!NOTE]
> - Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
> - Do not set up self-hosted runners on the side on your development environment or your production server.
> - Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
### Local Testing Setup
@ -689,7 +717,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
```
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
@ -700,6 +728,9 @@ Choose the image tag which matches the `runs-on` property in your workflow. For
# For runs-on: ubuntu-latest
act -P ubuntu-latest=shivammathur/node:latest
# For runs-on: ubuntu-24.04
act -P ubuntu-24.04=shivammathur/node:2404
# For runs-on: ubuntu-22.04
act -P ubuntu-22.04=shivammathur/node:2204
@ -716,13 +747,13 @@ act -P ubuntu-20.04=shivammathur/node:2004
- By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` are set which can be changed using `ini-values` input.
- For detailed information about JIT related directives refer to the [`official PHP documentation`](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit "opcache.jit documentation").
For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
```yaml
- name: Setup PHP with JIT in tracing mode
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
coverage: none
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
```
@ -742,7 +773,7 @@ If your project uses composer, you can persist the composer's internal cache dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@ -752,9 +783,9 @@ If your project uses composer, you can persist the composer's internal cache dir
run: composer install --prefer-dist
```
**Notes**
- Please do not cache `vendor` directory using `action/cache` as that will have side effects.
- If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
> [!NOTE]
> - Please do not cache `vendor` directory using `action/cache` as that will have side effects.
> - If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
```yaml
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
```
@ -775,7 +806,7 @@ The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHU
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
@ -788,7 +819,7 @@ If you use Private Packagist for your private composer dependencies, you can set
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
env:
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
```
@ -802,7 +833,7 @@ Please refer to the authentication section in [`composer documentation`](https:/
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
env:
COMPOSER_AUTH_JSON: |
{
@ -825,7 +856,7 @@ Put the code in the run property of a step and specify the shell as `php {0}`.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
- name: Run PHP code
shell: php {0}
@ -865,7 +896,7 @@ PHPStan supports error reporting in GitHub Actions, so it does not require probl
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: phpstan
- name: Run PHPStan
@ -880,7 +911,7 @@ Psalm supports error reporting in GitHub Actions with an output format `github`.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: psalm
- name: Run Psalm
@ -898,7 +929,7 @@ For examples refer to the [cs2pr documentation](https://github.com/staabm/annota
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
tools: cs2pr, phpcs
- name: Run phpcs
@ -939,14 +970,15 @@ Examples of using `setup-php` with various PHP frameworks and packages.
- Use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with the latest minor and patch releases. With `v2` you automatically get the bug fixes, security patches, new features and support for latest PHP releases.
- Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date.
- Commit SHA can also be used, but are not recommended. They have to be updated with every release manually, without which you will not get any bug fixes, security patches or new features.
- Commit SHA can also be used, but are not recommended unless you set up tooling to update them with each release of the action.
- A new major version of the action will only be tagged when there are breaking changes in the setup-php API i.e. inputs, outputs, and environment flags.
- For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
- It is highly discouraged to use the `master` branch as version, it might break your workflow after major releases as they have breaking changes.
- If you are using the `v1` tag or a `1.x.y` version, you should [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` only gets critical bug fixes. Maintenance support for `v1` will be dropped with the last `PHP 8.0` release.
- It is highly discouraged to use the `main` branch as version, it might break your workflow after major releases as they have breaking changes.
- If you are using the `v1` tag or a `1.x.y` version, you should [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` is not supported anymore.
## :scroll: License
- The scripts and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/setup-php").
- The scripts and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/setup-php").
- This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
@ -978,25 +1010,18 @@ These companies generously provide setup-php their products and services to aid
<p>
<a href="https://www.jetbrains.com/?from=setup-php">
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="212" height="120">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="148" height="60">
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="296" height="120">
</a>
<a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="148" height="60">
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="296" height="120">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="70" height="60">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/scaleway.png" alt="Scaleway" width="174" height="60">
</a>
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/scaleway-white.png" alt="Scaleway" width="174" height="60">
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="140" height="120">
</a>
</p>
@ -1028,15 +1053,19 @@ These companies generously provide setup-php their products and services to aid
[`behat`]: https://docs.behat.org/en/latest/
[`blackfire`]: https://blackfire.io/docs/php/index
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
[`box`]: https://github.com/humbug/box
[`castor`]: https://github.com/jolicode/castor
[`churn`]: https://github.com/bmitch/churn-php
[`codeception`]: https://codeception.com/
[`composer`]: https://getcomposer.org/
[`composer-dependency-analyser`]: https://github.com/shipmonk-rnd/composer-dependency-analyser
[`composer-normalize`]: https://github.com/ergebnis/composer-normalize
[`composer-prefetcher`]: https://github.com/narrowspark/automatic-composer-prefetcher
[`composer-require-checker`]: https://github.com/maglnet/ComposerRequireChecker
[`composer-unused`]: https://github.com/composer-unused/composer-unused
[`cs2pr`]: https://github.com/staabm/annotate-pull-request-from-checkstyle
[`deployer`]: https://deployer.org/
[`ecs`]: https://github.com/easy-coding-standard/easy-coding-standard
[`flex`]: https://flex.symfony.com/
[`grpc_php_plugin`]: https://grpc.io/
[`infection`]: https://infection.github.io/
@ -1048,9 +1077,10 @@ These companies generously provide setup-php their products and services to aid
[`phive`]: https://phar.io/
[`php-config`]: https://www.php.net/manual/en/install.pecl.php-config.php
[`php-cs-fixer`]: https://cs.symfony.com/
[`phpcbf`]: https://github.com/squizlabs/php_codesniffer
[`php-scoper`]: https://github.com/humbug/php-scoper
[`phpcbf`]: https://github.com/PHPCSStandards/php_codesniffer
[`phpcpd`]: https://github.com/sebastianbergmann/phpcpd
[`phpcs`]: https://github.com/squizlabs/php_codesniffer
[`phpcs`]: https://github.com/PHPCSStandards/php_codesniffer
[`phpdoc`]: https://phpdoc.org/
[`phpDocumentor`]: https://phpdoc.org/
[`phpize`]: https://www.php.net/manual/en/install.pecl.phpize.php

@ -19,9 +19,12 @@ describe('Extension tests', () => {
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'}
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'}
${'sqlsrv'} | ${'5.6'} | ${'Add-Extension sqlsrv'}
${'sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv sqlsrv'}
${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'}
${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'}
${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'}

@ -1,5 +1,5 @@
import * as fetch from '../src/fetch';
import nock = require('nock');
import nock from 'nock';
it('checking fetch', async () => {
const host_url = 'https://example.com';

@ -38,25 +38,30 @@ jest.mock('../src/install', () => ({
*/
jest.mock('../src/fetch', () => ({
fetch: jest.fn().mockImplementation(() => {
return {data: '{ "latest": "8.1", "5.x": "5.6" }'};
return {
data: '{ "latest": "8.3", "lowest": "8.1", "highest": "8.3", "nightly": "8.4", "5.x": "5.6" }'
};
})
}));
describe('Install', () => {
it.each`
version | os | extension_csv | ini_file | ini_values_csv | coverage_driver | tools | output
${'7.3'} | ${'darwin'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.3 production'}
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${''} | ${'bash darwin.sh 7.3 development install extensions set coverage driver edit php.ini'}
${'7.4.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.4 none'}
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 production'}
${'8.0'} | ${'darwin'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 development'}
${'8.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.1 none'}
${'7.3'} | ${'linux'} | ${''} | ${'invalid'} | ${''} | ${''} | ${''} | ${'bash linux.sh 7.3 production'}
${'7.3'} | ${'linux'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${'phpunit'} | ${'bash linux.sh 7.3 development install extensions add_tool set coverage driver edit php.ini'}
${'latest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.1 none'}
${'7.0'} | ${'win32'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.0 production'}
${'7.3'} | ${'win32'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.3 development'}
${'7.3'} | ${'win32'} | ${'a, b'} | ${'none'} | ${'a=b'} | ${'x'} | ${''} | ${'pwsh win32.ps1 7.3 none install extensions set coverage driver edit php.ini'}
version | os | extension_csv | ini_file | ini_values_csv | coverage_driver | tools | output
${'7.3'} | ${'darwin'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.3 production'}
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${''} | ${'bash darwin.sh 7.3 development install extensions set coverage driver edit php.ini'}
${'7.4.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.4 none'}
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 production'}
${'8.0'} | ${'darwin'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 development'}
${'8.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.1 none'}
${'7.3'} | ${'linux'} | ${''} | ${'invalid'} | ${''} | ${''} | ${''} | ${'bash linux.sh 7.3 production'}
${'7.3'} | ${'linux'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${'phpunit'} | ${'bash linux.sh 7.3 development install extensions add_tool set coverage driver edit php.ini'}
${'latest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
${'lowest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.1 none'}
${'highest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
${'nightly'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.4 none'}
${'7.0'} | ${'win32'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.0 production'}
${'7.3'} | ${'win32'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.3 development'}
${'7.3'} | ${'win32'} | ${'a, b'} | ${'none'} | ${'a=b'} | ${'x'} | ${''} | ${'pwsh win32.ps1 7.3 none install extensions set coverage driver edit php.ini'}
`(
'Test install on $os for $version with extensions=$extension_csv, ini_values=$ini_values_csv, coverage_driver=$coverage_driver, tools=$tools',
async ({

@ -1,5 +1,5 @@
import * as packagist from '../src/packagist';
import nock = require('nock');
import nock from 'nock';
describe('search function', () => {
const mockResponse = {

@ -1,3 +1,4 @@
import * as fs from 'fs';
import * as tools from '../src/tools';
interface IData {
@ -94,7 +95,7 @@ describe('Tools tests', () => {
${'beta_token'} | ${'1.2.3-beta1'}
${''} | ${'1.2.3'}
`('checking getSemverVersion: $token', async ({token, version}) => {
process.env['COMPOSER_TOKEN'] = token;
process.env['GITHUB_TOKEN'] = token;
expect(
await tools.getSemverVersion(getData({tool: 'tool', version: '1.2'}))
).toBe(version);
@ -280,16 +281,18 @@ describe('Tools tests', () => {
);
it.each`
version | php_version | url
${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'}
${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'}
${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
os | version | php_version | url
${'linux'} | ${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'}
${'linux'} | ${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
${'linux'} | ${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'}
${'linux'} | ${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'linux'} | ${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'win32'} | ${'latest'} | ${'7.0'} | ${'blackfire-player is not a windows tool'}
`(
'checking addBlackfirePlayer: $version, $php_version',
async ({version, php_version, url}) => {
'checking addBlackfirePlayer: $os, $version, $php_version',
async ({os, version, php_version, url}) => {
const data = getData({
os: os,
tool: 'blackfire-player',
domain: 'https://get.blackfire.io',
version_prefix: 'v',
@ -389,21 +392,23 @@ describe('Tools tests', () => {
it.each([
[
'blackfire, blackfire-player, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp',
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp',
[
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
'add_tool https://github.com/box-project/box/releases/latest/download/box.phar box "--version"',
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'add_composer_tool flex flex symfony/ global',
'add_grpc_php_plugin latest',
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
'add_tool https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
'add_composer_tool phplint phplint overtrue/',
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"',
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"',
'add_pecl',
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
'add_composer_tool phinx phinx robmorgan/ scoped',
@ -429,14 +434,15 @@ describe('Tools tests', () => {
it.each([
[
'behat, blackfire, blackfire-player, churn, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli',
'behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli',
[
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_composer_tool behat behat behat/ scoped',
'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "diagnose"',
'add_composer_tool composer-dependency-analyser composer-dependency-analyser shipmonk/ scoped',
'add_composer_tool composer-require-checker composer-require-checker maglnet/ scoped',
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused "-V"',
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"',
@ -449,9 +455,9 @@ describe('Tools tests', () => {
'add_composer_tool phinx phinx robmorgan/ scoped',
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive',
'add_devtools php-config',
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
'add_devtools phpize',
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
@ -463,7 +469,8 @@ describe('Tools tests', () => {
'add_composer_tool rector rector rector/ scoped',
'add_symfony latest',
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
'add_composer_tool easy-coding-standard easy-coding-standard symplify/ scoped'
]
]
])('checking addTools on darwin', async (tools_csv, scripts) => {
@ -479,7 +486,7 @@ describe('Tools tests', () => {
[
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'Add-Blackfire',
'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"',
'blackfire-player is not a windows tool',
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'Add-Tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
@ -526,10 +533,36 @@ describe('Tools tests', () => {
}
);
it.each`
version | os | uri
${'latest'} | ${'linux'} | ${'releases/latest/download/castor.linux-amd64.phar'}
${'0.5.1'} | ${'linux'} | ${'releases/download/v0.5.1/castor.linux-amd64.phar'}
${'latest'} | ${'darwin'} | ${'releases/latest/download/castor.darwin-amd64.phar'}
${'0.5.1'} | ${'darwin'} | ${'releases/download/v0.5.1/castor.darwin-amd64.phar'}
${'latest'} | ${'win32'} | ${'releases/latest/download/castor.windows-amd64.phar'}
${'0.5.1'} | ${'win32'} | ${'releases/download/v0.5.1/castor.windows-amd64.phar castor -V'}
${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
`('checking addCastor: $version, $os', async ({version, os, uri}) => {
const data = getData({
tool: 'castor',
php_version: '8.1',
version_prefix: 'v',
version: version,
os: os
});
if (os === 'win32' && version === '0.5.1') {
fs.writeFileSync('castor.php', '');
expect(await tools.addCastor(data)).toContain(uri);
fs.unlinkSync('castor.php');
} else {
expect(await tools.addCastor(data)).toContain(uri);
}
});
it.each`
tools_csv | script
${'none'} | ${''}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"'}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"'}
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
@ -543,7 +576,7 @@ describe('Tools tests', () => {
${'phpunit:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "phpunit" "Invalid token"'}
${'phpunit:0.1'} | ${'no_data'} | ${'add_log "$cross" "phpunit" "No version found with prefix 0.1."'}
`('checking error: $tools_csv', async ({tools_csv, token, script}) => {
process.env['COMPOSER_TOKEN'] = token;
process.env['GITHUB_TOKEN'] = token;
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
});

@ -282,6 +282,32 @@ describe('Utils tests', () => {
process.env['php-version'] = '8.2';
expect(await utils.readPHPVersion()).toBe('8.2');
delete process.env['php-version-file'];
delete process.env['php-version'];
existsSync.mockReturnValue(true);
readFileSync.mockReturnValue('ruby 1.2.3\nphp 8.4.2\nnode 20.1.2');
expect(await utils.readPHPVersion()).toBe('8.4.2');
existsSync.mockReturnValue(true);
readFileSync.mockReturnValue('setup-php');
expect(await utils.readPHPVersion()).toBe('setup-php');
existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true);
readFileSync.mockReturnValue(
'{ "platform-overrides": { "php": "7.3.25" } }'
);
expect(await utils.readPHPVersion()).toBe('7.3.25');
existsSync
.mockReturnValueOnce(false)
.mockReturnValueOnce(false)
.mockReturnValueOnce(true);
readFileSync.mockReturnValue(
'{ "config": { "platform": { "php": "7.4.33" } } }'
);
expect(await utils.readPHPVersion()).toBe('7.4.33');
existsSync.mockClear();
readFileSync.mockClear();
});

@ -31,5 +31,5 @@ outputs:
php-version:
description: 'PHP version in semver format'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'

5662
dist/index.js vendored

File diff suppressed because one or more lines are too long

51
eslint.config.mjs Normal file

@ -0,0 +1,51 @@
import {fixupConfigRules, fixupPluginRules} from '@eslint/compat';
// eslint-disable-next-line import/no-unresolved
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import jest from 'eslint-plugin-jest';
import globals from 'globals';
// eslint-disable-next-line import/no-unresolved
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import js from '@eslint/js';
import {FlatCompat} from '@eslint/eslintrc';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
'prettier'
)
),
{
plugins: {
'@typescript-eslint': fixupPluginRules(typescriptEslint),
jest
},
languageOptions: {
globals: {
...globals.node,
...globals.jest
},
parser: tsParser,
ecmaVersion: 2021,
sourceType: 'module'
}
}
];

@ -11,7 +11,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -19,7 +19,7 @@ jobs:
# blackfire-player supports PHP >= 5.5
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -19,7 +19,7 @@ jobs:
# Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -28,7 +28,7 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -28,7 +28,7 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -37,7 +37,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -39,7 +39,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -12,7 +12,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -37,7 +37,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -39,7 +39,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -12,7 +12,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -36,7 +36,7 @@ jobs:
# php-versions: ['7.0', '7.1', '7.2', '7.3']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -37,7 +37,7 @@ jobs:
# php-versions: ['7.0', '7.1', '7.2', '7.3']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -12,7 +12,7 @@ jobs:
node-versions: ['16']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v1

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -23,7 +23,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -23,7 +23,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -12,7 +12,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

@ -29,7 +29,7 @@ jobs:
php-versions: ['7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set Node.js 10.x
uses: actions/setup-node@v1

@ -29,7 +29,7 @@ jobs:
php-versions: ['7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set Node.js 10.x
uses: actions/setup-node@v1

8928
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.25.3",
"version": "2.32.0",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "lib/install.js",
@ -19,7 +19,7 @@
"lint": "eslint **/src/*.ts **/__tests__/*.ts --cache --fix",
"format": "prettier --write **/src/*.ts **/__tests__/*.ts && git add -f __tests__/ ",
"format-check": "prettier --check **/src/*.ts **/__tests__/*.ts",
"release": "ncc build -o dist && git add -f dist/",
"release": "ncc build -m -o dist && git add -f dist/",
"test": "jest"
},
"repository": {
@ -34,29 +34,32 @@
"author": "shivammathur",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"compare-versions": "^6.0.0-rc.1"
"compare-versions": "^6.1.1"
},
"devDependencies": {
"@types/jest": "^29.5.2",
"@types/node": "^20.3.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@vercel/ncc": "^0.36.1",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"jest-circus": "^29.5.0",
"nock": "^13.3.1",
"prettier": "^2.8.8",
"simple-git-hooks": "^2.8.1",
"ts-jest": "^29.1.0",
"typescript": "^5.1.3"
"@eslint/compat": "^1.2.7",
"@eslint/js": "9.22.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.13.10",
"@typescript-eslint/eslint-plugin": "^8.26.1",
"@typescript-eslint/parser": "^8.26.1",
"@vercel/ncc": "^0.38.3",
"eslint": "9.22.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.2.3",
"globals": "^16.0.0",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"nock": "^14.0.1",
"prettier": "^3.5.3",
"simple-git-hooks": "^2.11.1",
"ts-jest": "^29.2.6",
"typescript": "^5.8.2"
},
"bugs": {
"url": "https://github.com/shivammathur/setup-php/issues"

@ -37,6 +37,7 @@ swoole=swoole
uuid=uuid
v8js=v8js
vips=vips
vld=vld
xdebug=xdebug
xdebug2=xdebug
xlswriter=xlswriter

@ -6,11 +6,11 @@ couchbase=30
decimal=30
ds=30
event=30
ev=30
grpc=30
http=25
pecl_http=25
pecl-http=25
psr=15
inotify=30
libvirt-php=40
mailparse=25
@ -19,6 +19,7 @@ memcached=25
mysqlnd=10
mysqlnd_ms=30
opcache=10
openswoole=25
pdo=10
phalcon=35
protobuf=30

@ -17,3 +17,6 @@
21.04,hirsute
21.10,impish
22.04,jammy
23.04,lunar
23.10,mantic
24.04,noble

1 8 jessie
17 21.04 hirsute
18 21.10 impish
19 22.04 jammy
20 23.04 lunar
21 23.10 mantic
22 24.04 noble

@ -1,7 +1,9 @@
{
"latest": "8.2",
"nightly": "8.3",
"lowest": "8.1",
"highest": "8.4",
"latest": "8.4",
"nightly": "8.5",
"5.x": "5.6",
"7.x": "7.4",
"8.x": "8.2"
}
"8.x": "8.4"
}

@ -1,4 +1,13 @@
{
"box": {
"type": "phar",
"repository": "box-project/box",
"packagist": "humbug/box",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
"version_parameter": "--version"
},
"churn": {
"type": "phar",
"repository": "bmitch/churn-php",
@ -7,6 +16,11 @@
"version_prefix": "",
"version_parameter": "-V"
},
"composer-dependency-analyser": {
"type": "composer",
"repository": "shipmonk/composer-dependency-analyser",
"scope": "scoped"
},
"composer-unused": {
"type": "phar",
"repository": "composer-unused/composer-unused",
@ -21,7 +35,7 @@
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
"version_parameter": "-V"
"version_parameter": "diagnose"
},
"cs2pr": {
"type": "phar",
@ -57,16 +71,25 @@
},
"php-cs-fixer": {
"type": "phar",
"repository": "FriendsOfPHP/PHP-CS-Fixer",
"repository": "PHP-CS-Fixer/PHP-CS-Fixer",
"extension": ".phar",
"domain": "https://github.com",
"fetch_latest": "true",
"version_prefix": "v",
"version_parameter": "-V"
},
"php-scoper": {
"type": "phar",
"repository": "humbug/php-scoper",
"packagist": "humbug/php-scoper",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
"version_parameter": "--version"
},
"phpcbf": {
"type": "phar",
"repository": "squizlabs/PHP_CodeSniffer",
"repository": "PHPCSStandards/PHP_CodeSniffer",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
@ -74,7 +97,7 @@
},
"phpcs": {
"type": "phar",
"repository": "squizlabs/PHP_CodeSniffer",
"repository": "PHPCSStandards/PHP_CodeSniffer",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
@ -222,6 +245,14 @@
"version_prefix": "v",
"version_parameter": "-V"
},
"castor": {
"type": "custom-function",
"domain": "https://github.com",
"repository": "jolicode/castor",
"function": "castor",
"version_prefix": "v",
"version_parameter": "-V"
},
"composer": {
"type": "custom-function",
"domain": "https://getcomposer.org",
@ -267,7 +298,8 @@
},
"phpunit": {
"type": "custom-function",
"repository": "phpunit/phpunit",
"repository": "sebastianbergmann/phpunit",
"packagist": "phpunit/phpunit",
"domain": "https://phar.phpunit.de",
"function": "phpunit",
"version_prefix": "",
@ -291,5 +323,11 @@
"extension": ".phar",
"version_parameter": "--version",
"version_prefix": "v"
},
"easy-coding-standard": {
"type": "composer",
"alias": "ecs",
"repository": "symplify/easy-coding-standard",
"scope": "scoped"
}
}
}

@ -13,6 +13,7 @@
"fetch_latest": "true",
"function": "function_name",
"repository": "user/tool",
"packagist": "user/tool",
"scope": "global, scoped",
"type": "phar, composer, custom-package or custom-function",
"version_parameter": "--version",
@ -77,6 +78,15 @@
"user/tool"
]
},
"packagist": {
"$id": "#/items/properties/packagist",
"type": "string",
"title": "The repository schema",
"description": "Packagist repository of the tool in case different from repository.",
"examples": [
"user/tool"
]
},
"scope": {
"$id": "#/items/properties/scope",
"type": "string",

@ -31,26 +31,26 @@ export async function addExtensionDarwin(
case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix);
return;
// match 7.4relay...8.3relay
// match 5.3blackfire...8.2blackfire
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
// match 7.4relay...8.5relay
// match 5.3blackfire...8.4blackfire
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5
// match 7.0zephir_parser...8.2zephir_parser
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(
// match 5.3ioncube...8.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
// match 7.0zephir_parser...8.4zephir_parser
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
extension
):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test(
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-4])phalcon5?/.test(
version_extension
):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
version_extension
):
add_script += await utils.customPackage(
@ -83,7 +83,7 @@ export async function addExtensionDarwin(
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
return;
// match brew extensions
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|snmp|ssh2|swoole|uuid|xdebug|xdebug2|yaml|zmq)/.test(
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|snmp|ssh2|swoole|uuid|vld|xdebug|xdebug2|yaml|zmq)/.test(
version_extension
):
case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
@ -134,23 +134,24 @@ export async function addExtensionWindows(
case /^none$/.test(ext_name):
add_script += '\nDisable-AllShared';
break;
// match 5.3blackfire...8.2blackfire
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
// match 5.3blackfire...8.4blackfire
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5
// match 5.3ioncube...8.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
// match 7.0zephir_parser...8.2zephir_parser
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(
// match 7.0zephir_parser...8.4zephir_parser
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
version_extension
):
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
version_extension
):
add_script += await utils.customPackage(
@ -262,16 +263,16 @@ export async function addExtensionLinux(
case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix);
return;
// match 7.4relay...8.3relay
// match 5.3blackfire...8.2blackfire
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
// match 7.4relay...8.5relay
// match 5.3blackfire...8.4blackfire
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.2phalcon5
// match 7.0zephir_parser...8.2zephir_parser
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(
// match 5.3ioncube...8.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
// match 7.0zephir_parser...8.4zephir_parser
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
@ -281,12 +282,12 @@ export async function addExtensionLinux(
extension
):
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
version_extension
):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
version_extension
):
add_script += await utils.customPackage(

@ -26,7 +26,8 @@ export async function fetch(
const options: https.RequestOptions = {
hostname: url_object.hostname,
path: url_object.pathname,
headers: headers
headers: headers,
agent: new https.Agent({keepAlive: false})
};
const req = https.get(options, (res: IncomingMessage) => {
if (res.statusCode === 200) {

@ -14,7 +14,7 @@ import * as utils from './utils';
* @param os
*/
export async function getScript(os: string): Promise<string> {
const url = 'https://setup-php.com/support-ukraine';
const url = 'https://setup-php.com/sponsor';
const filename = os + (await utils.scriptExtension(os));
const script_path = path.join(__dirname, '../src/scripts', filename);
const run_path = script_path.replace(os, 'run');
@ -40,8 +40,8 @@ export async function getScript(os: string): Promise<string> {
if (ini_values_csv) {
script += await config.addINIValues(ini_values_csv, os);
}
script += '\n' + (await utils.stepLog(`#StandWithUkraine`, os));
script += '\n' + (await utils.addLog('$tick', 'read-more', url, os));
script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os));
script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os));
fs.writeFileSync(run_path, script, {mode: 0o755});

@ -1,13 +1,23 @@
# Disable dependency extensions
disable_dependency_extensions() {
local extension=$1
# Handle dependency extensions
handle_dependency_extensions() {
local formula=$1
local extension=$2
formula_file="${tap_dir:?}/$ext_tap/Formula/$extension@${version:?}.rb"
[ -e "$formula_file" ] || formula_file="$tap_dir/$ext_tap/Formula/$formula@$version.rb"
if [ -e "$formula_file" ]; then
IFS=" " read -r -a dependency_extensions <<< "$(grep -Eo "shivammathur.*@" "$formula_file" | xargs -I {} -n 1 basename '{}' | cut -d '@' -f 1 | tr '\n' ' ')"
for dependency_extension in "${dependency_extensions[@]}"; do
sudo sed -Ei '' "/=(.*\/)?\"?$dependency_extension(.so)?$/d" "${ini_file:?}"
done
fi
suffix="$(get_php_formula_suffix)"
if [[ -n "$suffix" ]]; then
brew_opts=(-sf)
patch_abstract_file >/dev/null 2>&1
for dependency_extension in "${dependency_extensions[@]}"; do
brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 && copy_brew_extensions "$dependency_extension"
done
fi
}
# Helper function to disable an extension.
@ -43,7 +53,9 @@ copy_brew_extensions() {
extension_file="${brew_prefix:?}/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so"
[ -e "$extension_file" ] && sudo cp "$extension_file" "$ext_dir"
done
sudo find -- "$brew_prefix"/Cellar/"$formula"@"$version" -name "*.dylib" -exec cp {} "$ext_dir" \;
if [ -d "$brew_prefix"/Cellar/"$formula"@"$version" ]; then
sudo find -- "$brew_prefix"/Cellar/"$formula"@"$version" -name "*.dylib" -exec cp {} "$ext_dir" \;
fi
}
# Function to install a php extension from shivammathur/extensions tap.
@ -59,13 +71,21 @@ add_brew_extension() {
add_brew_tap "$ext_tap"
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "${core_repo:?}/Formula/" 2>/dev/null || true
update_dependencies >/dev/null 2>&1
disable_dependency_extensions "$extension" >/dev/null 2>&1
brew install -f "$ext_tap/$formula@$version" >/dev/null 2>&1
copy_brew_extensions "$formula"
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
add_extension_log "$extension" "Installed and enabled"
fi
}
# Function to patch the abstract file in the extensions tap.
patch_abstract_file() {
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
fi
}
# Helper function to add an extension.
add_extension_helper() {
local extension=$1
@ -93,15 +113,13 @@ add_pecl() {
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
}
# Function to link all libraries of a formula.
link_libraries() {
formula=$1
formula_prefix="$(brew --prefix "$formula")"
sudo mkdir -p "$formula_prefix"/lib
for lib in "$formula_prefix"/lib/*.dylib; do
lib_name=$(basename "$lib")
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
done
# Link opcache extension to extensions directory.
link_opcache() {
opcache_ini="$brew_prefix"/etc/php/"$version"/conf.d/ext-opcache.ini
if [ -e "$opcache_ini" ]; then
opcache_ext=$(grep -Eo "zend_extension.*opcache.*\.so" "$opcache_ini" | cut -d '"' -f 2)
sudo ln -sf "$opcache_ext" "$ext_dir"
fi
}
# Patch brew to overwrite packages.
@ -113,48 +131,24 @@ patch_brew() {
trap "sudo sed -Ei '' 's/$code.*/$code, overwrite: overwrite?\)/' $formula_installer" exit
}
# Helper function to update the dependencies.
update_dependencies_helper() {
dependency=$1
get -q -n "$core_repo/Formula/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$dependency.rb"
link_libraries "$dependency"
}
# Function to update dependencies.
update_dependencies() {
patch_brew
if ! [ -e /tmp/update_dependencies ]; then
if [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
deps_file="$tap_dir/$php_tap/.github/deps/${ImageOS:?}_${ImageVersion:?}"
if [ -e "$deps_file" ]; then
while read -r dependency; do
update_dependencies_helper "$dependency" &
to_wait+=($!)
done <"$deps_file"
fi
wait "${to_wait[@]}"
else
git -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master
fi
for repo in "$brew_repo" "$core_repo"; do
git_retry -C "$repo" fetch origin master && git -C "$repo" reset --hard origin/master
done
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
fi
}
# Function to fix dependencies on install PHP version.
fix_dependencies() {
broken_deps_paths=$(php -v 2>&1 | grep -Eo '/opt/[a-zA-Z0-9@\.]+')
if [ "x$broken_deps_paths" != "x" ]; then
update_dependencies
IFS=" " read -r -a formulae <<< "$(echo "$broken_deps_paths" | tr '\n' ' ' | sed 's|/opt/||g' 2>&1)$php_formula"
brew reinstall "${formulae[@]}"
brew link --force --overwrite "$php_formula" || true
fi
}
# Function to get PHP version if it is already installed using Homebrew.
get_brewed_php() {
php_cellar="$brew_prefix"/Cellar/php
if [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
cellar="$brew_prefix"/Cellar
php_cellar="$cellar"/php
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3
else
echo 'false';
@ -167,15 +161,25 @@ add_php() {
existing_version=$2
add_brew_tap "$php_tap"
update_dependencies
[ "${debug:?}" = "debug" ] && php_formula="$php_formula-debug"
if [ "$existing_version" != "false" ]; then
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
suffix="$(get_php_formula_suffix)"
php_formula="shivammathur/php/php@$version$suffix"
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
([ "$action" = "upgrade" ] && brew upgrade -f --overwrite "$php_formula") || brew unlink "$php_formula"
else
brew install -f "$php_formula"
brew install -f --overwrite "$php_formula"
fi
sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix"
brew link --force --overwrite "$php_formula"
}
# Function to get formula suffix
get_php_formula_suffix() {
local suffix
[ "${debug:?}" = "debug" ] && suffix="-debug"
[ "${ts:?}" = "zts" ] && suffix="$suffix-zts"
echo "$suffix"
}
# Function to get extra version.
php_extra_version() {
php_formula_file="$tap_dir"/"$php_tap"/Formula/php@"$version".rb
@ -209,6 +213,8 @@ get_scan_dir() {
setup_php() {
step_log "Setup PHP"
php_config="$(command -v php-config 2>/dev/null)"
update=true
check_pre_installed
existing_version=$(get_brewed_php)
if [[ "$version" =~ ${old_versions:?} ]]; then
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
@ -216,15 +222,16 @@ setup_php() {
elif [ "$existing_version" != "$version" ]; then
add_php "install" "$existing_version" >/dev/null 2>&1
status="Installed"
elif [ "$existing_version" = "$version" ] && [ "${update:?}" = "true" ]; then
add_php "upgrade" "$existing_version" >/dev/null 2>&1
status="Updated to"
else
status="Found"
fix_dependencies >/dev/null 2>&1
elif [ "$existing_version" = "$version" ]; then
if [ "${update:?}" = "true" ]; then
add_php "upgrade" "$existing_version" >/dev/null 2>&1
status="Updated to"
else
status="Found"
fi
fi
php_config="$(command -v php-config)"
ext_dir="$(grep 'extension_dir=' "$php_config" | cut -d "'" -f 2)"
ext_dir="$(sed -n "s/.*extension_dir=['\"]\(.*\)['\"].*/\1/p" "$php_config")"
ini_dir="$(php_ini_path)"
scan_dir="$(get_scan_dir)"
ini_file="$ini_dir"/php.ini
@ -233,6 +240,7 @@ setup_php() {
semver="$(php_semver)"
extra_version="$(php_extra_version)"
configure_php
link_opcache
set_output "php-version" "$semver"
if [ "${semver%.*}" != "$version" ]; then
add_log "${cross:?}" "PHP" "Could not setup PHP $version"
@ -244,7 +252,7 @@ setup_php() {
}
# Variables
version=${1:-'8.2'}
version=${1:-'8.4'}
ini=${2:-'production'}
src=${0%/*}/..
php_formula=shivammathur/php/php@"$version"
@ -252,15 +260,16 @@ scripts="$src"/scripts
ext_tap=shivammathur/homebrew-extensions
php_tap=shivammathur/homebrew-php
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
export HOMEBREW_DEVELOPER=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_INSTALL_FROM_API=1
# shellcheck source=.
. "${scripts:?}"/unix.sh
. "${scripts:?}"/tools/brew.sh
. "${scripts:?}"/tools/retry.sh
. "${scripts:?}"/tools/add_tools.sh
. "${scripts:?}"/extensions/source.sh
. "${scripts:?}"/extensions/add_extensions.sh

@ -1,3 +1,16 @@
# Function to check if extension is enabled.
Function Test-Extension() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension
)
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
return $null -ne $extension_info
}
# Function to add extension log.
Function Add-ExtensionLog() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
@ -7,8 +20,7 @@ Function Add-ExtensionLog() {
[ValidateNotNull()]
$message
)
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
if ($null -ne $extension_info -and ($extension_info.State -eq 'Enabled' -or $extension_info.State -eq 'Builtin')) {
if (Test-Extension $extension) {
Add-Log $tick $extension $message
} else {
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
@ -54,7 +66,7 @@ Function Enable-Extension() {
}
# Function to add custom built PHP extension for nightly builds.
Function Add-NightlyExtension {
Function Add-ExtensionFromGithub {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
@ -88,7 +100,7 @@ Function Add-Extension {
$stability = 'stable',
[Parameter(Position = 2, Mandatory = $false)]
[ValidateNotNull()]
[ValidatePattern('^\d+(\.\d+){0,2}$')]
[ValidatePattern('^\d+(\.\d+){0,3}$')]
[string]
$extension_version = ''
)
@ -111,11 +123,11 @@ Function Add-Extension {
}
else {
if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
Add-NightlyExtension $extension
Add-ExtensionFromGithub $extension
} else {
# Patch till DLLs for PHP 8.1 and 8.2 are released as stable.
# Patch till DLLs for PHP 8.1 and above are released as stable.
$minimumStability = $stability
if ($version -match '8.[1-2]' -and $stability -eq 'stable') {
if ($version -match '8.[1-4]' -and $stability -eq 'stable') {
$minimumStability = 'snapshot'
}
@ -124,6 +136,10 @@ Function Add-Extension {
{
$params["Version"] = $extension_version
}
# If extension for a different version exists
if(Test-Path $ext_dir\php_$extension.dll) {
Move-Item $ext_dir\php_$extension.dll $ext_dir\php_$extension.bak.dll -Force
}
Install-PhpExtension @params
Set-ExtensionPrerequisites $extension
}
@ -245,4 +261,4 @@ Function Disable-AllShared() {
# Function to handle request to add PECL.
Function Add-Pecl() {
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
}
}

@ -176,21 +176,30 @@ pecl_install() {
local extension=$1
local prefix=${2:-extension}
add_pecl >/dev/null 2>&1
cpu_count="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo '1')"
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
if [ "$version" = "5.3" ]; then
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
# Compare version with 8.3 so it runs only on 8.4 and above
# Install using the source interface as it allows for patching.
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
extension_version=${extension##*-};
[ "$extension_version" = "${extension%-*}" ] && extension_version=$(get_pecl_version "$extension" "stable")
add_extension_from_source "${extension%-*}" https://pecl.php.net "${extension%-*}" "${extension%-*}" "$extension_version" "$prefix" pecl
check_extension "${extension%-*}" && return 0 || return 1;
else
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
cpu_count="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo '1')"
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
if [ "$version" = "5.3" ]; then
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
else
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
fi
local exit_code=$?
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
enable_extension "${extension%-*}" "$prefix"
return "$exit_code"
fi
local exit_code=$?
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
enable_extension "${extension%-*}" "$prefix"
return "$exit_code"
}
# Function to install a specific version of PECL extension.
@ -203,7 +212,7 @@ add_pecl_extension() {
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
fi
ext_version=$(php -r "echo phpversion('$extension');")
if [ "${ext_version/-/}" = "$pecl_version" ]; then
if check_extension "$extension" && [[ -z "$pecl_version" || (-n "$pecl_version" && "${ext_version/-/}" == "$pecl_version") ]]; then
add_log "${tick:?}" "$extension" "Enabled"
else
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"

@ -22,6 +22,8 @@ Function Add-Blackfire() {
} else {
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
Get-File -Url "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
Disable-Extension xdebug > $null 2>&1
Disable-Extension pcov > $null 2>&1
Enable-PhpExtension -Extension blackfire -Path $php_dir
$status="Installed and enabled"
}

@ -8,6 +8,10 @@ add_blackfire() {
status='Enabled'
if ! shared_extension blackfire; then
status='Installed and enabled'
arch="$(uname -m)"
arch_name="amd64"
[[ "$arch" = "aarch64" || "$arch" = "arm64" ]] && arch_name="arm64"
[ "${ts:?}" = 'zts' ] && no_dot_version="${no_dot_version}-zts"
if [ "$extension_version" = "blackfire" ]; then
if [[ ${version:?} =~ 5.[3-6] ]]; then
extension_version='1.50.0'
@ -15,8 +19,14 @@ add_blackfire() {
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
fi
fi
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so >/dev/null 2>&1
fi
if [ -e "${ext_dir:?}/blackfire.so" ]; then
disable_extension xdebug >/dev/null 2>&1
disable_extension pcov >/dev/null 2>&1
enable_extension blackfire extension
add_extension_log blackfire "$status"
else
add_extension_log blackfire "Could not install blackfire on PHP ${semver:?}"
fi
enable_extension blackfire extension
add_extension_log blackfire "$status"
}

@ -7,15 +7,27 @@ add_couchbase_clibs() {
else
release=$(get -s -n "" "$trunk"/latest | grep -Eo -m 1 "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
fi
[ "$VERSION_ID" = "22.04" ] && vid=20.04 || vid="$VERSION_ID"
[ "$VERSION_CODENAME" = "jammy" ] && vcn=focal || vcn="$VERSION_CODENAME"
[ "$VERSION_ID" = "24.04" ] && vid=22.04 || vid="$VERSION_ID"
[ "$VERSION_CODENAME" = "noble" ] && vcn=jammy || vcn="$VERSION_CODENAME"
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${vid/./}_${vcn}_amd64.tar"
get -q -n /tmp/libcouchbase.tar "$deb_url"
if ! [ -e /tmp/libcouchbase.tar ] || ! file /tmp/libcouchbase.tar | grep -q 'tar archive'; then
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu2004_focal_amd64.tar"
get -q -n /tmp/libcouchbase.tar "$deb_url"
add_old_libssl
fi
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
install_packages libev4 libevent-dev
sudo dpkg -i /tmp/libcouchbase-*/*.deb
}
add_old_libssl() {
if [[ "$VERSION_ID" = "24.04" ]]; then
get -q -n /tmp/libssl.deb http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
[ -e /tmp/libssl.deb ] && sudo dpkg -i /tmp/libssl.deb || add_extension_log "couchbase" "Could not install libssl1.1"
fi
}
add_couchbase_cxxlibs() {
if [ "${runner:?}" = "self-hosted" ]; then
add_list cmake https://apt.kitware.com/ubuntu/ https://apt.kitware.com/keys/kitware-archive-latest.asc "$VERSION_CODENAME" main
@ -32,6 +44,8 @@ get_couchbase_version() {
echo couchbase-3.0.4
elif [ "${version:?}" = '7.3' ]; then
echo couchbase-3.2.2
elif [ "${version:?}" = '7.4' ]; then
echo couchbase-4.1.1
else
echo couchbase
fi
@ -55,6 +69,9 @@ add_couchbase() {
else
if [ "$ext" = "couchbase" ]; then
ext="couchbase-$(get_pecl_version "couchbase" "stable")"
n_proc="$(nproc)"
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
else
pecl_install "${ext}" >/dev/null 2>&1

@ -13,7 +13,7 @@ get_event_configure_opts() {
)
else
event_opts+=(
--with-openssl-dir="$(brew --prefix openssl@1.1)"
--with-openssl-dir="$(brew --prefix openssl@3)"
--with-event-libevent-dir="$(brew --prefix libevent)"
)
fi

@ -1,17 +1,21 @@
add_firebird_client_darwin() {
firebird_tag='R3_0_7'
pkg_name=$(get -s -n "" https://api.github.com/repos/FirebirdSQL/firebird/releases/tags/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1)
[ -z "$pkg_name" ] && pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/expanded_assets/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1)
firebird_tag='v5.0.0'
arch_name='x64'
arch="$(uname -m)"
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && arch_name='arm64'
pkg_name=$(get -s -n "" https://api.github.com/repos/FirebirdSQL/firebird/releases/tags/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
[ -z "$pkg_name" ] && pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/expanded_assets/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/download/"$firebird_tag"/"$pkg_name"
sudo installer -pkg /tmp/firebird.pkg -target /
sudo mkdir -p /opt/firebird/include /opt/firebird/lib
sudo find /Library/Frameworks/Firebird.framework -name '*.h' -exec cp "{}" /opt/firebird/include \;
sudo cp -a /Library/Frameworks/Firebird.framework/Headers/* /opt/firebird/include/
sudo find /Library/Frameworks/Firebird.framework -name '*.dylib' -exec cp "{}" /opt/firebird/lib \;
}
add_firebird_helper() {
firebird_dir=$1
tag="$(php_src_tag)"
export PDO_FIREBIRD_CONFIGURE_PREFIX_OPTS="CFLAGS=-Wno-incompatible-function-pointer-types EXTRA_CFLAGS=-Wno-int-conversion"
export PDO_FIREBIRD_CONFIGURE_OPTS="--with-pdo-firebird=$firebird_dir"
export PDO_FIREBIRD_LINUX_LIBS="firebird-dev"
export PDO_FIREBIRD_PATH="ext/pdo_firebird"

@ -2,9 +2,9 @@
install_icu() {
icu=$1
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu.tar.zst"
get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu$arch_suffix.tar.zst"
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
sudo cp -r /usr/local/icu/lib/* /usr/lib/"$(uname -m)"-linux-gnu/
fi
}
@ -17,8 +17,11 @@ add_intl() {
else
[ "${ts:?}" = 'zts' ] && suffix='-zts'
install_icu "$icu" >/dev/null 2>&1
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix.so"
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix$arch_suffix.so"
enable_extension intl extension
add_extension_log intl "Installed and enabled with ICU $icu"
fi
}
arch="$(uname -m)"
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch_suffix='-arm64' || arch_suffix=''

@ -10,12 +10,25 @@ add_ioncube() {
status='Enabled'
if ! shared_extension ioncube; then
status='Installed and enabled'
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "${ext_dir:?}/ioncube.so"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
arch="$(uname -m)"
if [ "$(uname -s)" = "Darwin" ]; then
[ "$arch" = "arm64" ] && os_suffix="dar_arm64" || os_suffix="mac_x86-64"
else
[[ "$arch" = "i386" || "$arch" = "i686" ]] && arch=x86
[[ "$arch" = "x86_64" ]] && arch=x86-64
os_suffix="lin_$arch"
fi
ts_part="" && [ "${ts:?}" = "zts" ] && ts_part="_ts"
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_suffix".tar.gz | tar -xzf - -C /tmp
loader_file=/tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so
if [ -e "$loader_file" ]; then
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
fi
else
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
fi
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
add_extension_log "ioncube" "$status"
check_extension "ioncube" && add_license_log
}

@ -48,6 +48,7 @@ Function Get-Oci8DLL() {
return $_
}
}
return $null
}
# Function to install oci8 and pdo_oci.
@ -62,22 +63,17 @@ Function Add-Oci() {
try {
$status = 'Enabled'
Add-InstantClient
if ($extension -eq "pdo_oci") {
Enable-PhpExtension pdo_oci -Path $php_dir
} else {
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
$oci8DLL = Get-Oci8DLL
if($oci8DLL) {
Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
} else {
$status = 'Installed and enabled'
Get-File -Url (Get-Oci8Url) -OutFile $php_dir\oci8.zip
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
}
if($version -lt '8.4') {
if($version -lt '5.6' -and $extension -eq 'oci8') {
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
} else {
Enable-PhpExtension $extension -Path $php_dir
}
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
} else {
$status = 'Installed and enabled'
Add-Extension $extension >$null 2>&1
}
Add-Log $tick $extension $status
Add-ExtensionLog $extension $status
Add-LicenseLog
} catch {
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"

@ -11,25 +11,37 @@ add_license_log() {
add_client() {
if [ ! -e "$oracle_client" ]; then
sudo mkdir -p -m 777 "$oracle_home" "$oracle_client"
arch="$(uname -m)"
for package in basiclite sdk; do
if [ "$os" = 'Linux' ]; then
libs='/usr/lib/'
os_name='linux'
arch='linuxx64'
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch_suffix='linux-arm64' || arch_suffix='linuxx64'
lib_ext='so'
elif [ "$os" = 'Darwin' ]; then
libs='/usr/local/lib/'
os_name='mac'
arch='macos'
arch_suffix='macos'
lib_ext='dylib'
fi
get -q -n "/opt/oracle/$package.zip" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
unzip -o "/opt/oracle/$package.zip" -d "$oracle_home"
if [[ "$os" = 'Darwin' && ("$arch" = 'arm64' || "$arch" = 'aarch64') ]]; then
get -q -n "/opt/oracle/$package.dmg" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-macos-arm64.dmg"
sudo hdiutil attach "/opt/oracle/$package.dmg"
(cd /Volumes/instantclient-"$package"-macos.arm64-* && bash install_ic.sh)
sudo cp -a ~/Downloads/instantclient_* /opt/oracle/
else
get -q -n "/opt/oracle/$package.zip" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch_suffix.zip"
unzip -o "/opt/oracle/$package.zip" -d "$oracle_home"
fi
done
for icdir in /opt/oracle/instantclient_*; do
sudo mv "$icdir"/* "$oracle_client"/
done
sudo mkdir -p "$libs"
sudo ln -sf /opt/oracle/instantclient/*.$lib_ext* $libs
if [ "$os" = "Linux" ]; then
[ -e "$libs/$arch"-linux-gnu/libaio.so.1 ] || sudo ln -sf "$libs/$arch"-linux-gnu/libaio.so.1t64 "$libs/$arch"-linux-gnu/libaio.so.1
fi
fi
}
@ -39,9 +51,13 @@ add_oci_helper() {
status='Installed and enabled'
read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
read -r "${ext}_PATH" <<< "ext/$ext"
patch_phpize
add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
add_extension_from_source "$ext" https://github.com php pecl-database-"$ext" main extension get
else
read -r "${ext}_PATH" <<< "ext/$ext"
add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
fi
restore_phpize
else
enable_extension "$ext" extension

@ -0,0 +1,12 @@
process_file() {
local file=$1
sed -i'' -e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//\#include <ext\/random\/php_random.h>/' "$file"
sed -i'' -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file"
}
export -f process_file
# Compare with 8.3 so it runs only on 8.4 and above
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
find . -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c 'process_file "$0"' {} \;
fi

@ -3,5 +3,7 @@ patch_geos() {
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
fi
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
patch -p1 < /tmp/php8.patch 2>/dev/null || true
patch -p1 < /tmp/toString.patch 2>/dev/null || true
}

@ -8,19 +8,36 @@ Function Get-PhalconReleaseAssetUrl() {
)
$domain = 'https://api.github.com/repos'
$releases = 'phalcon/cphalcon/releases'
$match = $null
if($extension_version -match '[3-4]') {
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
try {
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
} catch {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
} catch { }
if($null -eq $match) {
try {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
} catch { }
}
} else {
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
try {
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
if($null -eq $match) {
try {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
}
if($null -eq $match) {
try {
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
}
if($null -eq $match) {
try {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
}
}
if($NULL -ne $match) {
@ -54,6 +71,8 @@ Function Get-PhalconSemver() {
return '3.4.5'
} elseif (($extension_version -eq '4') -and ($version -eq '7.2')) {
return '4.1.0'
} elseif (($extension_version -eq '5') -and ($version -eq '7.4')) {
return '5.4.0'
}
return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
}

@ -1,7 +1,11 @@
# Helper function to get phalcon version
get_phalcon_version() {
if [ "$extension" = "phalcon5" ]; then
get_pecl_version phalcon stable 5
if [ "${version:?}" = "7.4" ]; then
echo '5.4.0'
else
get_pecl_version phalcon stable 5
fi
elif [ "$extension" = "phalcon4" ]; then
echo '4.1.2'
elif [ "$extension" = "phalcon3" ]; then
@ -31,7 +35,7 @@ add_phalcon_helper() {
else
package="php${version:?}-$extension"
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
[ "$extension" = "phalcon4" ] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
[[ "$extension" =~ phalcon[4|5] ]] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
fi
}
@ -69,7 +73,7 @@ add_phalcon4() {
fi
}
# Function to add phalcon3.
# Function to add phalcon5.
add_phalcon5() {
if shared_extension phalcon; then
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
@ -87,6 +91,7 @@ add_phalcon5() {
add_phalcon() {
local extension=$1
status='Enabled'
[ "$extension" = "phalcon" ] && extension=phalcon5
extension_major_version=${extension: -1}
if [[ "$extension_major_version" =~ [3-5] ]]; then
add_phalcon"$extension_major_version" >/dev/null 2>&1

@ -2,7 +2,11 @@
get_relay_version() {
local ext=$1
if [[ "$ext" =~ ^relay$ ]]; then
get -s -n "" "${relay_releases:?}"/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2
if [ "${version:?}" = "7.4" ]; then
echo 'v0.7.0'
else
get -s -n "" "${relay_releases:?}"/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2
fi
else
relay_version="${ext##*-}"
echo "v${relay_version/v//}"
@ -40,6 +44,7 @@ change_library_paths() {
install_name_tool -change "$(echo "${dylibs}" | grep -E "liblz4.*dylib" | xargs)" "$brew_prefix"/opt/lz4/lib/liblz4.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "libssl.*dylib" | xargs)" "$brew_prefix"/opt/openssl@"$openssl_version"/lib/libssl.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "libcrypto.*dylib" | xargs)" "$brew_prefix"/opt/openssl@"$openssl_version"/lib/libcrypto.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "libck.*dylib" | xargs)" "$brew_prefix"/opt/concurrencykit/lib/libck.dylib "$ext_dir"/relay.so
fi
}
@ -51,7 +56,7 @@ add_relay_dependencies() {
if [ "$os" = "Darwin" ]; then
. "${0%/*}"/tools/brew.sh
configure_brew
brew install hiredis lz4 zstd
brew install hiredis lz4 zstd concurrencykit
fi
}
@ -92,8 +97,7 @@ enable_relay() {
# Patch binary id in relay extension
init_relay_binary_id() {
if [ -e "${ext_dir:?}"/relay.so ]; then
grep -aq 00000000 "${ext_dir:?}"/relay.so && \
sudo LC_ALL=C sed -i.bak "s/00000000-0000-0000-0000-000000000000/$(uuidgen)/" "$ext_dir"/relay.so
sudo LC_ALL=C sed -i.bak "s/00000000-0000-0000-0000-000000000000/$(uuidgen)/" "$ext_dir"/relay.so || true
fi
}

@ -89,6 +89,8 @@ run_group() {
patch_extension() {
local extension=$1
# shellcheck source=.
. "${scripts:?}"/extensions/patches/common.sh
if [ -e "${scripts:?}"/extensions/patches/"$extension".sh ]; then
# shellcheck source=.
. "${scripts:?}"/extensions/patches/"$extension".sh
@ -150,7 +152,7 @@ add_extension_from_source() {
patch_extension "$extension" >/dev/null 2>&1
run_group "phpize" "phpize"
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
run_group "sudo make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
run_group "sudo make install" "make install"
enable_extension "$extension" "$prefix"
fi

@ -0,0 +1,78 @@
# Function to get sqlsrv extension version.
Function Get-SqlsrvReleaseVersion() {
if ($version -le '7.2') {
# Use the releases from PECL for these versions
return null;
} elseif($version -eq '7.3') {
return '5.9.0'
} elseif ($version -eq '7.4') {
return '5.10.1'
} elseif ($version -eq '8.0') {
return '5.11.1'
} else {
return 'latest'
}
}
# Function to get sqlsrv extension release URL.
Function Get-SqlsrvReleaseUrl()
{
$extensionVersion = Get-SqlsrvReleaseVersion
if($extensionVersion) {
$repo = "$github/microsoft/msphpsql"
if($extensionVersion -eq 'latest') {
return "$repo/releases/latest/download/Windows-$version.zip"
} else {
return "$repo/releases/download/v$extensionVersion/Windows-$version.zip"
}
}
}
# Function to add sqlsrv extension from GitHub.
Function Add-SqlsrvFromMSGithub()
{
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension
)
try {
$zipUrl = SqlsrvReleaseUrl
if($zipUrl) {
$nts = if (!$installed.ThreadSafe) { "nts" } else { "ts" }
$noDotVersion = $version.replace('.', '')
$extensionFilePath = "Windows-$version\$arch\php_${extension}_${noDotVersion}_${nts}.dll"
Get-File -Url $zipUrl -OutFile $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip > $null 2>&1
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\sqlsrv -Force > $null 2>&1
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\sqlsrv\$extensionFilePath" -Destination "$ext_dir\php_$extension.dll"
Enable-PhpExtension -Extension $extension -Path $php_dir
}
} catch { }
}
# Function to add sqlsrv extension.
Function Add-Sqlsrv() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension
)
$status = 'Enabled'
if (Test-Path $ext_dir\php_$extension.dll) {
Enable-PhpExtension -Extension $extension -Path $php_dir
} else {
try {
Add-ExtensionFromGithub $extension > $null 2>&1
} catch {}
if (-not(Test-Extension $extension)) {
Add-SqlsrvFromMSGithub $extension >$null 2>&1
}
if (-not(Test-Extension $extension)) {
Add-Extension $extension >$null 2>&1
}
$status = 'Installed and enabled'
}
Add-ExtensionLog $extension $status
}

@ -2,8 +2,13 @@
get_sqlsrv_version() {
if [[ "${version:?}" =~ 7.[0-3] ]]; then
echo '5.9.0'
else
elif [[ "${version:?}" =~ 7.4 ]]; then
echo '5.10.1'
elif [[ "${version:?}" =~ 8.0 ]]; then
echo '5.11.1'
else
# Return an empty string so that pecl will install the latest version.
echo ''
fi
}

@ -71,10 +71,14 @@ Function Add-ZephirParser() {
Enable-PhpExtension -Extension zephir_parser -Path $php_dir
} else {
$status = 'Installed and enabled'
Add-ZephirParserFromGitHub $extension
try {
Add-ZephirParserFromGitHub $extension
} catch {
Add-Extension $extension >$null 2>&1
}
}
Add-ExtensionLog zephir_parser $status
} catch {
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
}
}
}

@ -17,9 +17,13 @@ add_zephir_parser_helper() {
[ "$(uname -s)" = "Linux" ] && os_suffix=ubuntu || os_suffix=macos
build_name=$(get -s -n "" https://api.github.com/repos/"$repo"/releases/tags/"$ext_version" | grep -Eo "zephir_parser-php-${version:?}-$nts-$os_suffix-.*.zip" | head -n 1)
[ -z "$build_name" ] && build_name=$(get -s -n "" "$zp_releases"/expanded_assets/"$ext_version" | grep -Eo "zephir_parser-php-${version:?}-$nts-$os_suffix-.*.zip" | head -n 1)
get -q -e "/tmp/zp.zip" "$zp_releases"/download/"$ext_version"/"$build_name"
sudo unzip -o "/tmp/zp.zip" -d "${ext_dir:?}"
enable_extension zephir_parser extension
if [ -n "$build_name" ]; then
get -q -e "/tmp/zp.zip" "$zp_releases"/download/"$ext_version"/"$build_name"
sudo unzip -o "/tmp/zp.zip" -d "${ext_dir:?}"
enable_extension zephir_parser extension
else
pecl_install zephir_parser
fi
}
# Add zephir_parser

@ -6,6 +6,14 @@ add_sudo() {
fi
}
# Function to link apt-fast to apt-get
link_apt_fast() {
if ! command -v apt-fast >/dev/null; then
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
fi
}
# Function to setup environment for self-hosted runners.
self_hosted_helper() {
if ! command -v apt-fast >/dev/null; then
@ -23,6 +31,10 @@ fix_broken_packages() {
# Function to install a package
install_packages() {
packages=("$@")
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
fi
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
}
@ -99,8 +111,8 @@ add_devtools() {
add_log "${tick:?}" "$tool" "Added $tool $semver"
}
# Function to setup the nightly build from shivammathur/php-builder
setup_nightly() {
# Function to setup PHP from the shivammathur/php-builder builds.
setup_php_builder() {
run_script "php-builder" "${runner:?}" "$version" "${debug:?}" "${ts:?}"
}
@ -109,6 +121,11 @@ setup_old_versions() {
run_script "php5-ubuntu" "$version"
}
# Function to setup PHP from the cached builds.
setup_cached_versions() {
run_script "php-ubuntu" "$version" "${debug:?}" "${ts:?}"
}
# Function to add PECL.
add_pecl() {
add_devtools phpize >/dev/null 2>&1
@ -149,13 +166,9 @@ get_php_packages() {
# Function to install packaged PHP
add_packaged_php() {
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
install_packages "${packages[@]}"
else
run_script "php-ubuntu" "$version" "${debug:?}"
fi
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
install_packages "${packages[@]}"
}
# Function to update PHP.
@ -172,14 +185,18 @@ update_php() {
# Function to install PHP.
add_php() {
if [[ "$version" =~ ${nightly_versions:?} ]] || [[ "${ts:?}" = "zts" ]]; then
setup_nightly
if [ "${runner:?}" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
if [[ "$version" =~ ${nightly_versions:?} || "$ts" = "zts" ]]; then
setup_php_builder
else
add_packaged_php
switch_version >/dev/null 2>&1
add_pecl
fi
elif [[ "$version" =~ ${old_versions:?} ]]; then
setup_old_versions
else
add_packaged_php
switch_version >/dev/null 2>&1
add_pecl
setup_cached_versions
fi
status="Installed"
}
@ -229,6 +246,7 @@ setup_php() {
step_log "Setup PHP"
sudo mkdir -m 777 -p /var/run /run/php
php_config="$(command -v php-config)"
check_pre_installed
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
add_php >/dev/null 2>&1
@ -272,7 +290,7 @@ setup_php() {
}
# Variables
version=${1:-'8.2'}
version=${1:-'8.4'}
ini=${2:-'production'}
src=${0%/*}/..
debconf_fix="DEBIAN_FRONTEND=noninteractive"
@ -280,6 +298,7 @@ apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
scripts="$src"/scripts
add_sudo >/dev/null 2>&1
link_apt_fast >/dev/null 2>&1
. /etc/os-release
# shellcheck source=.

@ -23,7 +23,7 @@ Function Edit-ComposerConfig() {
if (-not(Test-Path $composer_json)) {
Set-Content -Path $composer_json -Value "{}"
}
Add-EnvPATH $src\configs\composer.env
Set-ComposerEnv
Add-Path $composer_bin
Set-ComposerAuth
}
@ -52,12 +52,20 @@ Function Set-ComposerAuth() {
}
}
# Function to set composer environment variables.
Function Set-ComposerEnv() {
if ($env:COMPOSER_PROCESS_TIMEOUT) {
(Get-Content $src\configs\composer.env -Raw) -replace '(?m)^COMPOSER_PROCESS_TIMEOUT=.*$', "COMPOSER_PROCESS_TIMEOUT=$env:COMPOSER_PROCESS_TIMEOUT" | Set-Content $src\configs\composer.env
}
Add-EnvPATH $src\configs\composer.env
}
# Function to extract tool version.
Function Get-ToolVersion() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
$tool,
[Parameter(Position = 1, Mandatory = $true)]
[Parameter(Position = 1, Mandatory = $false)]
$param
)
$alp = "[a-zA-Z0-9\.]"
@ -72,7 +80,9 @@ Function Get-ToolVersion() {
Set-Variable -Name 'composer_version' -Value $composer_version -Scope Global
return "$composer_version"
}
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
if($null -ne $param) {
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
}
}
# Helper function to configure tools.
@ -83,7 +93,9 @@ Function Add-ToolsHelper() {
$tool
)
$extensions = @();
if($tool -eq "codeception") {
if($tool -eq "box") {
$extensions += @('iconv', 'mbstring', 'phar', 'sodium')
} elseif($tool -eq "codeception") {
$extensions += @('json', 'mbstring')
Copy-Item $env:codeception_bin\codecept.bat -Destination $env:codeception_bin\codeception.bat
} elseif($tool -eq "composer") {
@ -135,8 +147,7 @@ Function Add-Tool() {
[Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()]
$tool,
[Parameter(Position = 2, Mandatory = $true)]
[ValidateNotNull()]
[Parameter(Position = 2, Mandatory = $false)]
$ver_param
)
if (Test-Path $bin_dir\$tool) {

@ -19,7 +19,7 @@ get_tool_version() {
composer_version="$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
fi
echo "$composer_version" | sudo tee /tmp/composer_version
else
elif [ -n "$param" ]; then
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
fi
}
@ -42,7 +42,7 @@ configure_composer() {
echo '{}' | tee "$composer_json" >/dev/null
chmod 644 "$composer_json"
fi
add_env_path "${src:?}"/configs/composer.env
set_composer_env
add_path "$composer_bin"
set_composer_auth
}
@ -68,11 +68,25 @@ set_composer_auth() {
fi
}
# Function to set composer environment variables.
set_composer_env() {
composer_env="${src:?}"/configs/composer.env
if [ -n "$COMPOSER_PROCESS_TIMEOUT" ]; then
sed_arg="s/COMPOSER_PROCESS_TIMEOUT.*/COMPOSER_PROCESS_TIMEOUT=$COMPOSER_PROCESS_TIMEOUT/"
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
fi
add_env_path "$composer_env"
}
# Helper function to configure tools.
add_tools_helper() {
tool=$1
extensions=()
if [ "$tool" = "codeception" ]; then
if [ "$tool" = "blackfire-player" ]; then
extensions+=(uuid)
elif [ "$tool" = "box" ]; then
extensions+=(iconv mbstring phar sodium)
elif [ "$tool" = "codeception" ]; then
extensions+=(json mbstring)
sudo ln -s "$scoped_dir"/vendor/bin/codecept "$scoped_dir"/vendor/bin/codeception
elif [ "$tool" = "composer" ]; then
@ -128,6 +142,9 @@ add_tool() {
tool=$2
ver_param=$3
tool_path="$tool_path_dir/$tool"
if ! [ -d "$tool_path_dir" ]; then
sudo mkdir -p "$tool_path_dir"
fi
add_path "$tool_path_dir"
if [ -e "$tool_path" ]; then
sudo cp -aL "$tool_path" /tmp/"$tool"

@ -62,6 +62,7 @@ configure_brew() {
add_brew
brew_path="$(command -v brew)"
fi
brew_opts=(-f)
brew_path_dir="$(dirname "$brew_path")"
brew_prefix="$brew_path_dir"/..
brew_repo="$brew_path_dir/$(dirname "$(readlink "$brew_path")")"/..
@ -69,11 +70,11 @@ configure_brew() {
core_repo="$tap_dir"/homebrew/homebrew-core
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
export HOMEBREW_DEVELOPER=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export brew_opts
export brew_path
export brew_path_dir
export brew_prefix

@ -9,7 +9,13 @@ Function Add-Msys2() {
Function Add-GrpcPhpPlugin() {
$msys_location = Add-Msys2
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
$arch = arch
if($arch -eq 'arm64' -or $arch -eq 'aarch64') {
$grpc_package = 'mingw-w64-clang-aarch64-grpc'
} else {
$grpc_package = 'mingw-w64-x86_64-grpc'
}
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package" >$null 2>&1
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
Add-Path $msys_location\mingw64\bin
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"

@ -24,8 +24,10 @@ get_grpc_tag() {
add_grpc_php_plugin_brew() {
. "${0%/*}"/tools/brew.sh
configure_brew
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
brew install grpc
brew link --force --overwrite grpc >/dev/null 2>&1
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
license_path="$(brew --prefix grpc)/LICENSE"
}

@ -31,10 +31,6 @@ set_base_version() {
else
set_base_version_codename
set_base_version_id
# Remove once PPAs start having bookworm releases
[ "$VERSION_CODENAME" = 'bookworm' ] && VERSION_CODENAME="bullseye"
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1
fi
}
@ -58,8 +54,8 @@ update_lists() {
status_file=/tmp/os_lists
if [[ -n "$ppa" && -n "$ppa_search" ]]; then
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
status_file=/tmp/"${ppa/\//_}"
elif grep -Eq '^deb ' "$list_file"; then
status_file=/tmp/"$(echo -n "$ppa_search" | shasum -a 256 | cut -d ' ' -f 1)"
elif [ -e "$list_file" ] && grep -Eq '^deb |^Types deb' "$list_file"; then
list="$list_file"
fi
if [ ! -e "$status_file" ]; then
@ -71,7 +67,7 @@ update_lists() {
# Function to get fingerprint from an Ubuntu PPA.
ubuntu_fingerprint() {
ppa=$1
get -s -n "" "$lp_api"/~"${ppa%/*}"/+archive/"${ppa##*/}" | jq -r '.signing_key_fingerprint'
get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
}
# Function to get fingerprint from a Debian PPA.
@ -92,7 +88,7 @@ add_key() {
key_source=$4
key_file=$5
key_urls=("$key_source")
if [[ "$key_source" =~ launchpad.net|debian.org|setup-php.com ]]; then
if [[ "$key_source" =~ launchpadcontent.net|debian.org ]]; then
fingerprint="$("${ID}"_fingerprint "$ppa" "$ppa_url" "$package_dist")"
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
@ -121,11 +117,11 @@ check_lists() {
# Function to add a sources list.
add_list() {
ppa=${1-ondrej/php}
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
key_source=${3:-"$ppa_url"}
package_dist=${4:-"$VERSION_CODENAME"}
branches=${5:-main}
ppa_search="deb .*$ppa_url $package_dist .*$branches"
ppa_search="deb .*$ppa_url $package_dist .*$branches$"
if check_lists "$ppa" "$ppa_search"; then
echo "Repository $ppa already exists";
return 1;
@ -143,10 +139,10 @@ add_list() {
# Function to check if a PPA exists
check_ppa() {
ppa=$1
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
package_dist=${3:-"$VERSION_CODENAME"}
branches=${4:-main}
ppa_search="deb .*$ppa_url $package_dist .*$branches"
ppa_search="deb .*$ppa_url $package_dist .*$branches$"
if check_lists "$ppa" "$ppa_search"; then
return 0;
else
@ -157,18 +153,39 @@ check_ppa() {
# Function to remove a PPA.
remove_list() {
ppa=${1-ondrej/php}
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
[ -n "$2" ] && ppa_urls=("$2") || ppa_urls=("$lp_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu")
for ppa_url in "${ppa_urls[@]}"; do
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
done
sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring || true
}
# Function to check if ubuntu ppa is up
is_ubuntu_ppa_up() {
ppa=${1:-ondrej/php}
curl -s --connect-timeout 5 --max-time 5 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
}
# Function to add the PPA mirror.
add_ppa_sp_mirror() {
ppa=$1
ppa_name="$(basename "$ppa")"
remove_list "$ppa" || true
[ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg"
}
# Function to add a PPA.
add_ppa() {
set_base_version
ppa=${1:-ondrej/php}
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
add_list "$ppa"
if is_ubuntu_ppa_up "$ppa" ; then
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lpc_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
add_list "$ppa"
else
add_ppa_sp_mirror "$ppa"
fi
elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg
@ -184,7 +201,7 @@ add_ppa() {
update_ppa() {
set_base_version
ppa=${1:-ondrej/php}
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
package_dist=${4:-"$VERSION_CODENAME"}
branches=${5:-main}
ppa_search="deb .*$ppa_url $package_dist .*$branches"
@ -193,14 +210,20 @@ update_ppa() {
}
# Variables
list_file='/etc/apt/sources.list'
list_dir="$list_file.d"
list_dir='/etc/apt/sources.list.d'
list_file="/etc/apt/sources.list.d/$ID.sources"
[ -e "$list_file" ] || list_file='/etc/apt/sources.list'
upstream_lsb='/etc/upstream-release/lsb-release'
lp_api='https://api.launchpad.net/1.0'
lp_api=(
'https://api.launchpad.net/1.0'
'https://api.launchpad.net/devel'
)
lp_ppa='http://ppa.launchpad.net'
lpc_ppa='https://ppa.launchpadcontent.net'
key_dir='/usr/share/keyrings'
dist_info_dir='/usr/share/distro-info'
sury='https://packages.sury.org'
sp='https://setup-php.com'
sks=(
'https://keyserver.ubuntu.com'
'https://pgp.mit.edu'

@ -17,7 +17,9 @@ add_protoc() {
(
platform='linux'
[ "$(uname -s)" = "Darwin" ] && platform='osx'
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip"
arch="$(uname -m)"
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch='aarch_64'
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
sudo unzip /tmp/protobuf.zip -d /usr/local/
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
) >/dev/null 2>&1

@ -0,0 +1,20 @@
function retry {
local try=0
until "$@"; do
exit_code="$?"
try=$((try + 1))
if [ $try -lt 10 ]; then
sleep "$((2 ** try))"
else
return $exit_code
fi
done
return 0
}
function git_retry {
retry git "$@"
}

@ -51,7 +51,7 @@ set_output() {
read_env() {
update="${update:-${UPDATE:-false}}"
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
[ "${phpts:-${PHPTS:-nts}}" = "ts" ] && ts=zts && update=true || ts=nts
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
[[ -z "${ImageOS}" && -z "${ImageVersion}" || -n ${ACT} ]] && _runner=self-hosted || _runner=github
runner="${runner:-${RUNNER:-$_runner}}"
@ -63,7 +63,12 @@ read_env() {
# Set Update to true if the ubuntu github image does not have PHP PPA.
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
check_ppa ondrej/php || update=true
if ! check_ppa ondrej/php; then
update=true
echo '' | sudo tee /tmp/sp_update >/dev/null 2>&1
elif [ -e /tmp/sp_update ]; then
update=true
fi
fi
export fail_fast
@ -72,6 +77,32 @@ read_env() {
export ts
}
# Function to create a lock.
acquire_lock() {
lock_path="$1"
while true; do
if sudo mkdir "$lock_path" 2>/dev/null; then
echo $$ | sudo tee "$lock_path/pid" >/dev/null
return 0
else
if sudo test -f "$lock_path/pid"; then
lock_pid=$(sudo cat "$lock_path/pid")
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
sudo rm -rf "$lock_path"
continue
fi
fi
sleep 1
fi
done
}
# Function to release the lock.
release_lock() {
lock_path="$1"
sudo rm -rf "$lock_path"
}
# Function to download a file using cURL.
# mode: -s pipe to stdout, -v save file and return status code
# execute: -e save file as executable
@ -84,12 +115,23 @@ get() {
if [ "$mode" = "-s" ]; then
sudo curl "${curl_opts[@]}" "${links[0]}"
else
if [ "$runner" = "self-hosted" ]; then
lock_path="$file_path.lock"
acquire_lock "$lock_path"
if [ "$execute" = "-e" ]; then
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
sleep 1
done
fi
trap 'release_lock "$lock_path"' EXIT SIGINT SIGTERM
fi
for link in "${links[@]}"; do
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
[ "$status_code" = "200" ] && break
done
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
[ "$mode" = "-v" ] && echo "$status_code"
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
fi
}
@ -168,6 +210,19 @@ self_hosted_setup() {
fi
}
# Function to check pre-installed PHP
check_pre_installed() {
if [ "$version" = "pre" ]; then
if [ -n "$php_config" ]; then
version="$(php_semver | cut -c 1-3)"
update=false
else
fail_fast=true
add_log "$cross" "PHP" "No pre-installed PHP version found"
fi
fi
}
# Function to configure PHP
configure_php() {
add_php_config

@ -3,7 +3,7 @@ param (
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$version = '8.2',
$version = '8.4',
[Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
@ -133,14 +133,14 @@ Function Get-File {
param (
[string]$Url,
[string]$FallbackUrl,
[string]$OutFile,
[string]$OutFile = '',
[int]$Retries = 3,
[int]$TimeoutSec = 0
)
for ($i = 0; $i -lt $Retries; $i++) {
try {
if($null -ne $OutFile) {
if($OutFile -ne '') {
Invoke-WebRequest -Uri $Url -OutFile $OutFile -TimeoutSec $TimeoutSec
} else {
Invoke-WebRequest -Uri $Url -TimeoutSec $TimeoutSec
@ -150,7 +150,7 @@ Function Get-File {
if ($i -eq ($Retries - 1)) {
if($FallbackUrl) {
try {
if($null -ne $OutFile) {
if($OutFile -ne '') {
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
} else {
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
@ -332,8 +332,8 @@ if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
$arch = 'x86'
}
$ts = $env:PHPTS -eq 'ts'
if($env:PHPTS -ne 'ts') {
$ts = ($env:PHPTS -match '^z?ts$')
if(-not($ts)) {
$env:PHPTS = '-nts'
} else {
$env:PHPTS = ''
@ -401,6 +401,15 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
}
$status = "Installed"
$extra_version = ""
if($version -eq 'pre') {
if($null -ne $installed) {
$version = $installed.MajorMinorVersion
$env:update = 'false'
} else {
Add-Log $cross "PHP" "No pre-installed PHP version found"
Write-Error "No pre-installed PHP version found" -ErrorAction Stop
}
}
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
@ -434,7 +443,7 @@ if($installed.MajorMinorVersion -ne $version) {
Write-Error "Could not setup PHP $version" -ErrorAction Stop
}
if($version -lt "5.5") {
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Get-File -Url "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
} else {
$enable_extensions += ('opcache')
}

@ -22,11 +22,9 @@ interface IRef {
export async function getSemverVersion(data: RS): Promise<string> {
const search: string = data['version_prefix'] + data['version'];
const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
let github_token: string = await utils.readEnv('GITHUB_TOKEN');
const composer_token: string = await utils.readEnv('COMPOSER_TOKEN');
if (composer_token && !github_token) {
github_token = composer_token;
}
const github_token: string =
(await utils.readEnv('GITHUB_TOKEN')) ||
(await utils.readEnv('COMPOSER_TOKEN'));
const response: RS = await fetch.fetch(url, github_token);
if (response.error || response.data === '[]') {
data['error'] = response.error ?? `No version found with prefix ${search}.`;
@ -219,15 +217,40 @@ export async function addPackage(data: RS): Promise<string> {
* @param data
*/
export async function addBlackfirePlayer(data: RS): Promise<string> {
if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3';
} else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
switch (data['os']) {
case 'win32':
return await utils.addLog(
'$cross',
data['tool'],
data['tool'] + ' is not a windows tool',
'win32'
);
default:
if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3';
} else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}
/**
* Function to add Castor
*
* @param data
*/
export async function addCastor(data: RS): Promise<string> {
data['tool'] = 'castor.' + data['os'].replace('win32', 'windows') + '-amd64';
data['url'] = await getUrl(data);
data['tool'] = 'castor';
data['version_parameter'] = fs.existsSync('castor.php')
? data['version_parameter']
: '';
return await addArchive(data);
}
/**
@ -395,10 +418,13 @@ export async function addPhive(data: RS): Promise<string> {
export async function addPHPUnitTools(data: RS): Promise<string> {
if (data['version'] === 'latest') {
data['version'] =
(await packagist.search(data['repository'], data['php_version'])) ??
(await packagist.search(data['packagist'], data['php_version'])) ??
'latest';
}
data['url'] = await getPharUrl(data);
if (data['url'].match(/-\d+/)) {
data['url'] += ',' + data['url'].replace(/-(\d+)\.\d+\.\d+/, '-$1');
}
return await addArchive(data);
}
@ -464,6 +490,7 @@ export async function getData(
data['extension'] ??= '.phar';
data['os'] = os;
data['php_version'] = php_version;
data['packagist'] ??= data['repository'];
data['prefix'] = data['github'] === data['domain'] ? 'releases' : '';
data['verb'] = data['github'] === data['domain'] ? 'download' : '';
data['fetch_latest'] ??= 'false';
@ -478,6 +505,7 @@ export async function getData(
}
export const functionRecord: Record<string, (data: RS) => Promise<string>> = {
castor: addCastor,
composer: addComposer,
deployer: addDeployer,
dev_tools: addDevTools,

@ -59,7 +59,7 @@ export async function getManifestURL(): Promise<string> {
*/
export async function parseVersion(version: string): Promise<string> {
switch (true) {
case /^(latest|nightly|\d+\.x)$/.test(version):
case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
return JSON.parse((await fetch.fetch(await getManifestURL()))['data'])[
version
];
@ -436,10 +436,41 @@ export async function readPHPVersion(): Promise<string> {
const versionFile =
(await getInput('php-version-file', false)) || '.php-version';
if (fs.existsSync(versionFile)) {
return fs.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, '');
const contents: string = fs.readFileSync(versionFile, 'utf8');
const match: RegExpMatchArray | null = contents.match(
/^(?:php\s)?(\d+\.\d+\.\d+)$/m
);
return match ? match[1] : contents.trim();
} else if (versionFile !== '.php-version') {
throw new Error(`Could not find '${versionFile}' file.`);
}
const composerProjectDir = await readEnv('COMPOSER_PROJECT_DIR');
const composerLock = path.join(composerProjectDir, 'composer.lock');
if (fs.existsSync(composerLock)) {
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
if (
lockFileContents['platform-overrides'] &&
lockFileContents['platform-overrides']['php']
) {
return lockFileContents['platform-overrides']['php'];
}
}
const composerJson = path.join(composerProjectDir, 'composer.json');
if (fs.existsSync(composerJson)) {
const composerFileContents = JSON.parse(
fs.readFileSync(composerJson, 'utf8')
);
if (
composerFileContents['config'] &&
composerFileContents['config']['platform'] &&
composerFileContents['config']['platform']['php']
) {
return composerFileContents['config']['platform']['php'];
}
}
return 'latest';
}