setup-php 2.13.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +990 -922
  3. package/lib/config.d.ts +3 -0
  4. package/lib/config.js +71 -71
  5. package/lib/config.js.map +1 -1
  6. package/lib/coverage.d.ts +5 -0
  7. package/lib/coverage.js +97 -87
  8. package/lib/coverage.js.map +1 -1
  9. package/lib/extensions.d.ts +4 -0
  10. package/lib/extensions.js +214 -200
  11. package/lib/extensions.js.map +1 -1
  12. package/lib/fetch.d.ts +1 -0
  13. package/lib/fetch.js +63 -0
  14. package/lib/fetch.js.map +1 -0
  15. package/lib/install.d.ts +2 -0
  16. package/lib/install.js +75 -81
  17. package/lib/install.js.map +1 -1
  18. package/lib/tools.d.ts +23 -0
  19. package/lib/tools.js +367 -386
  20. package/lib/tools.js.map +1 -1
  21. package/lib/utils.d.ts +21 -0
  22. package/lib/utils.js +261 -291
  23. package/lib/utils.js.map +1 -1
  24. package/package.json +67 -56
  25. package/src/config.ts +82 -82
  26. package/src/configs/brew_extensions +31 -0
  27. package/src/configs/composer.env +2 -0
  28. package/src/configs/ini/jit.ini +3 -0
  29. package/src/configs/ini/php.ini +2 -0
  30. package/src/configs/ini/xdebug.ini +1 -0
  31. package/src/configs/os_releases.csv +19 -17
  32. package/src/configs/php-versions.json +6 -5
  33. package/src/configs/php_packages +12 -0
  34. package/src/configs/{php.json → pm/php.json} +29 -29
  35. package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
  36. package/src/configs/tools.json +278 -235
  37. package/src/configs/tools_schema.json +125 -114
  38. package/src/coverage.ts +144 -142
  39. package/src/extensions.ts +367 -349
  40. package/src/fetch.ts +54 -0
  41. package/src/install.ts +66 -82
  42. package/src/scripts/darwin.sh +285 -249
  43. package/src/scripts/extensions/add_extensions.ps1 +194 -0
  44. package/src/scripts/extensions/add_extensions.sh +184 -0
  45. package/src/scripts/{ext → extensions}/blackfire.ps1 +32 -32
  46. package/src/scripts/{ext → extensions}/blackfire.sh +22 -21
  47. package/src/scripts/{ext → extensions}/couchbase.sh +43 -43
  48. package/src/scripts/{ext → extensions}/cubrid.sh +60 -60
  49. package/src/scripts/extensions/extension_map.php +132 -0
  50. package/src/scripts/{ext → extensions}/firebird.ps1 +19 -19
  51. package/src/scripts/{ext → extensions}/firebird.sh +39 -35
  52. package/src/scripts/{ext → extensions}/gearman.sh +22 -22
  53. package/src/scripts/{ext → extensions}/geos.sh +17 -17
  54. package/src/scripts/{ext → extensions}/http.ps1 +54 -54
  55. package/src/scripts/{ext → extensions}/http.sh +109 -120
  56. package/src/scripts/{ext → extensions}/intl.sh +23 -23
  57. package/src/scripts/{ext → extensions}/ioncube.ps1 +33 -32
  58. package/src/scripts/{ext → extensions}/ioncube.sh +21 -19
  59. package/src/scripts/{ext → extensions}/oci.ps1 +85 -60
  60. package/src/scripts/{ext → extensions}/oci.sh +65 -63
  61. package/src/scripts/{ext → extensions}/patches/firebird.sh +11 -11
  62. package/src/scripts/{ext → extensions}/patches/geos.sh +7 -7
  63. package/src/scripts/{ext → extensions}/patches/http.sh +11 -11
  64. package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +6 -6
  65. package/src/scripts/{ext → extensions}/patches/phpize.sh +26 -26
  66. package/src/scripts/{ext → extensions}/patches/protobuf.sh +4 -4
  67. package/src/scripts/{ext → extensions}/phalcon.ps1 +54 -54
  68. package/src/scripts/{ext → extensions}/phalcon.sh +58 -58
  69. package/src/scripts/{ext → extensions}/source.sh +145 -144
  70. package/src/scripts/extensions/sqlsrv.sh +15 -0
  71. package/src/scripts/linux.sh +269 -256
  72. package/src/scripts/tools/add_tools.ps1 +239 -26
  73. package/src/scripts/tools/add_tools.sh +175 -20
  74. package/src/scripts/tools/blackfire.ps1 +19 -19
  75. package/src/scripts/tools/blackfire.sh +40 -39
  76. package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
  77. package/src/scripts/tools/grpc_php_plugin.sh +58 -58
  78. package/src/scripts/tools/ppa.sh +192 -151
  79. package/src/scripts/tools/protoc.ps1 +38 -38
  80. package/src/scripts/tools/protoc.sh +28 -28
  81. package/src/scripts/tools/symfony.ps1 +14 -0
  82. package/src/scripts/tools/symfony.sh +13 -0
  83. package/src/scripts/unix.sh +186 -0
  84. package/src/scripts/win32.ps1 +352 -494
  85. package/src/tools.ts +512 -538
  86. package/src/utils.ts +415 -500
  87. package/.eslintrc.json +0 -16
  88. package/.github/CODE_OF_CONDUCT.md +0 -76
  89. package/.github/CONTRIBUTING.md +0 -70
  90. package/.github/FUNDING.yml +0 -7
  91. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
  92. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  93. package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
  94. package/.github/SECURITY.md +0 -29
  95. package/.github/workflows/docs.yml +0 -77
  96. package/.github/workflows/node-workflow.yml +0 -51
  97. package/.github/workflows/workflow.yml +0 -78
  98. package/.idea/workspace.xml +0 -113
  99. package/.prettierrc.json +0 -12
  100. package/__tests__/config.test.ts +0 -52
  101. package/__tests__/coverage.test.ts +0 -110
  102. package/__tests__/extensions.test.ts +0 -263
  103. package/__tests__/install.test.ts +0 -175
  104. package/__tests__/tools.test.ts +0 -524
  105. package/__tests__/utils.test.ts +0 -307
  106. package/action.yml +0 -29
  107. package/dist/index.js +0 -3051
  108. package/examples/bedrock.yml +0 -32
  109. package/examples/blackfire-player.yml +0 -31
  110. package/examples/blackfire.yml +0 -31
  111. package/examples/cakephp-mysql.yml +0 -114
  112. package/examples/cakephp-postgres.yml +0 -112
  113. package/examples/cakephp.yml +0 -92
  114. package/examples/codeigniter.yml +0 -34
  115. package/examples/laravel-mysql.yml +0 -74
  116. package/examples/laravel-postgres.yml +0 -74
  117. package/examples/laravel.yml +0 -42
  118. package/examples/lumen-mysql.yml +0 -74
  119. package/examples/lumen-postgres.yml +0 -74
  120. package/examples/lumen.yml +0 -38
  121. package/examples/phalcon-mysql.yml +0 -74
  122. package/examples/phalcon-postgres.yml +0 -73
  123. package/examples/sage.yml +0 -57
  124. package/examples/slim-framework.yml +0 -34
  125. package/examples/symfony-mysql.yml +0 -57
  126. package/examples/symfony-postgres.yml +0 -55
  127. package/examples/symfony.yml +0 -39
  128. package/examples/yii2-mysql.yml +0 -73
  129. package/examples/yii2-postgres.yml +0 -71
  130. package/examples/zend-framework.yml +0 -36
  131. package/jest.config.js +0 -12
  132. package/lib/sapi.js +0 -64
  133. package/src/scripts/common.sh +0 -314
  134. package/tsconfig.json +0 -18
package/README.md CHANGED
@@ -1,922 +1,990 @@
1
- <p align="center">
2
- <a href="https://github.com/marketplace/actions/setup-php-action" target="_blank">
3
- <img src="https://repository-images.githubusercontent.com/206578964/e0a18480-dc65-11e9-8dd3-b9ffbf5575fe" alt="Setup PHP in GitHub Actions" width="400">
4
- </a>
5
- </p>
6
-
7
- <h1 align="center">Setup PHP in GitHub Actions</h1>
8
-
9
- <p align="center">
10
- <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>
11
- <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>
12
- <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>
13
- <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.1-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
14
- </p>
15
- <p align="center">
16
- <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>
17
- <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>
18
- <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>
19
- </p>
20
-
21
- 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.
22
-
23
- ## Contents
24
-
25
- - [OS/Platform Support](#cloud-osplatform-support)
26
- - [GitHub-Hosted Runners](#github-hosted-runners)
27
- - [Self-Hosted Runners](#self-hosted-runners)
28
- - [PHP Support](#tada-php-support)
29
- - [PHP Extension Support](#heavy_plus_sign-php-extension-support)
30
- - [Tools Support](#wrench-tools-support)
31
- - [Coverage Support](#signal_strength-coverage-support)
32
- - [Xdebug](#xdebug)
33
- - [PCOV](#pcov)
34
- - [Disable Coverage](#disable-coverage)
35
- - [Usage](#memo-usage)
36
- - [Inputs](#inputs)
37
- - [Outputs](#outputs)
38
- - [Flags](#flags)
39
- - [Basic Setup](#basic-setup)
40
- - [Matrix Setup](#matrix-setup)
41
- - [Nightly Build Setup](#nightly-build-setup)
42
- - [Thread Safe Setup](#thread-safe-setup)
43
- - [Force Update Setup](#force-update-setup)
44
- - [Verbose Setup](#verbose-setup)
45
- - [Multi-Arch Setup](#multi-arch-setup)
46
- - [Self Hosted Setup](#self-hosted-setup)
47
- - [Local Testing Setup](#local-testing-setup)
48
- - [JIT Configuration](#jit-configuration)
49
- - [Cache Extensions](#cache-extensions)
50
- - [Cache Composer Dependencies](#cache-composer-dependencies)
51
- - [Composer GitHub OAuth](#composer-github-oauth)
52
- - [Inline PHP Scripts](#inline-php-scripts)
53
- - [Problem Matchers](#problem-matchers)
54
- - [Examples](#examples)
55
- - [Versioning](#bookmark-versioning)
56
- - [License](#scroll-license)
57
- - [Contributions](#1-contributions)
58
- - [Support This Project](#sparkling_heart-support-this-project)
59
- - [Dependencies](#package-dependencies)
60
- - [Further Reading](#bookmark_tabs-further-reading)
61
-
62
- ## :cloud: OS/Platform Support
63
-
64
- Both `GitHub-hosted` and `self-hosted` runners are suppported by `setup-php` on the following OS/Platforms.
65
-
66
- ### GitHub-Hosted Runners
67
-
68
- |Virtual environment|YAML workflow label|Pre-installed PHP|
69
- |--- |--- |--- |
70
- |Ubuntu 18.04|`ubuntu-18.04`|`PHP 7.1` to `PHP 8.0`|
71
- |Ubuntu 20.04|`ubuntu-latest` or `ubuntu-20.04`|`PHP 7.4` to `PHP 8.0`|
72
- |Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 8.0`|
73
- |Windows Server 2022|`windows-2022`|`PHP 8.0`|
74
- |macOS Catalina 10.15|`macos-latest` or `macos-10.15`|`PHP 8.0`|
75
- |macOS Big Sur 11.x|`macos-11`|`PHP 8.0`|
76
-
77
- ### Self-Hosted Runners
78
-
79
- |Host OS/Virtual environment|YAML workflow label|
80
- |--- |--- |
81
- |Ubuntu 18.04|`self-hosted` or `Linux`|
82
- |Ubuntu 20.04|`self-hosted` or `Linux`|
83
- |Ubuntu 21.04|`self-hosted` or `Linux`|
84
- |Debian 9|`self-hosted` or `Linux`|
85
- |Debian 10|`self-hosted` or `Linux`|
86
- |Debian 11|`self-hosted` or `Linux`|
87
- |Windows 7 and newer|`self-hosted` or `Windows`|
88
- |Windows Server 2012 R2 and newer|`self-hosted` or `Windows`|
89
- |macOS Catalina 10.15|`self-hosted` or `macOS`|
90
- |macOS Big Sur 11.x x86_64/arm64|`self-hosted` or `macOS`|
91
-
92
- - Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
93
- - Operating systems based on the above Ubuntu and Debian versions are also supported on a best effort basis.
94
- - If the requested PHP version is pre-installed, `setup-php` switches to it, otherwise it installs the PHP version.
95
-
96
- ## :tada: PHP Support
97
-
98
- On all supported OS/Platforms the following PHP versions are supported as per the runner.
99
-
100
- - PHP 5.3 to PHP 8.1 on GitHub-hosted runners.
101
- - PHP 5.6 to PHP 8.1 on self-hosted runners.
102
-
103
- |PHP Version|Stability|Release Support|Runner Support|
104
- |--- |--- |--- |--- |
105
- |`5.3`|`Stable`|`End of life`|`GitHub-hosted`|
106
- |`5.4`|`Stable`|`End of life`|`GitHub-hosted`|
107
- |`5.5`|`Stable`|`End of life`|`GitHub-hosted`|
108
- |`5.6`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
109
- |`7.0`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
110
- |`7.1`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
111
- |`7.2`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
112
- |`7.3`|`Stable`|`Security fixes only`|`GitHub-hosted`, `self-hosted`|
113
- |`7.4`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
114
- |`8.0`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
115
- |`8.1`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`|
116
-
117
- **Notes:**
118
- - Specifying `8.1` in `php-version` input installs a nightly build of `PHP 8.1.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
119
- - To use JIT on `PHP 8.0` and `PHP 8.1` refer to the [JIT configuration](#jit-configuration) section.
120
-
121
- ## :heavy_plus_sign: PHP Extension Support
122
-
123
- PHP extensions can be set up using the `extensions` input. It accepts a `string` in csv-format.
124
-
125
- - On `Ubuntu`, extensions which are available as a package, available on `PECL` or a git repository can be set up.
126
-
127
- ```yaml
128
- - name: Setup PHP with PECL extension
129
- uses: shivammathur/setup-php@v2
130
- with:
131
- php-version: '8.0'
132
- extensions: imagick, swoole
133
- ```
134
-
135
- - On `Windows`, extensions available on `PECL` which have the `DLL` binary can be set up.
136
-
137
- - On `macOS`, extensions available on `PECL` or a git repository can be set up.
138
-
139
- - On `Ubuntu` and `macOS` to compile and install an extension from a git repository follow this [guide](https://github.com/shivammathur/setup-php/wiki/Add-extension-from-source "Guide to compile and install PHP extensions in setup-php").
140
-
141
- - Extensions installed along with PHP if specified are enabled.
142
-
143
- - Specific versions of extensions available on `PECL` can be set up by suffixing the extension's name with the version. This is useful for installing old versions of extensions which support end of life PHP versions.
144
-
145
- ```yaml
146
- - name: Setup PHP with specific version of PECL extension
147
- uses: shivammathur/setup-php@v2
148
- with:
149
- php-version: '5.4'
150
- extensions: swoole-1.9.3
151
- ```
152
-
153
- - Pre-release versions extensions available on `PECL` can be set up by suffixing the extension's name with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
154
-
155
- ```yaml
156
- - name: Setup PHP with pre-release PECL extension
157
- uses: shivammathur/setup-php@v2
158
- with:
159
- php-version: '8.0'
160
- extensions: xdebug-beta
161
- ```
162
-
163
- - Shared extensions can be removed by prefixing them with a `:`.
164
-
165
- ```yaml
166
- - name: Setup PHP and remove shared extension
167
- uses: shivammathur/setup-php@v2
168
- with:
169
- php-version: '8.0'
170
- extensions: :opcache
171
- ```
172
-
173
- - Extension `intl` can be set up with specific `ICU` version for `PHP 5.6` and above in `Ubuntu` workflows by suffixing `intl` with the `ICU` version. `ICU 50.2` and newer versions are supported. Refer to [`ICU builds`](https://github.com/shivammathur/icu-intl#icu4c-builds) for the specific versions supported.
174
-
175
- ```yaml
176
- - name: Setup PHP with intl
177
- uses: shivammathur/setup-php@v2
178
- with:
179
- php-version: '8.0'
180
- extensions: intl-69.1
181
- ```
182
-
183
- - Extensions loaded by default after `setup-php` runs can be found on the [wiki](https://github.com/shivammathur/setup-php/wiki).
184
-
185
- - These extensions have custom support:
186
- - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`.
187
- - `geos` on `Ubuntu` and `macOS`.
188
- - `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_oci`, `pecl_http`, `phalcon3` and `phalcon4` on all supported OS.
189
-
190
- - By default, extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
191
-
192
- ```yaml
193
- - name: Setup PHP with fail-fast
194
- uses: shivammathur/setup-php@v2
195
- with:
196
- php-version: '8.0'
197
- extensions: oci8
198
- env:
199
- fail-fast: true
200
- ```
201
-
202
- ## :wrench: Tools Support
203
-
204
- These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
205
-
206
- `behat`, `blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `php-config`, `php-cs-fixer`, `phpcbf`, `phpcpd`, `phpcs`, `phpize`, `phplint`, `phpmd`, `phpspec`, `phpstan`, `phpunit`, `phpunit-bridge`, `prestissimo`, `protoc`, `psalm`, `symfony` or `symfony-cli`, `vapor` or `vapor-cli`, `wp` or `wp-cli`
207
-
208
- ```yaml
209
- - name: Setup PHP with tools
210
- uses: shivammathur/setup-php@v2
211
- with:
212
- php-version: '8.0'
213
- tools: php-cs-fixer, phpunit
214
- ```
215
-
216
- - In addition to above tools any composer tool or package can also be set up globally by specifying it as `vendor/package` matching the listing on Packagist. This format accepts the same [version constraints](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints "Composer version constraints") as `composer`.
217
-
218
- ```yaml
219
- - name: Setup PHP with tools
220
- uses: shivammathur/setup-php@v2
221
- with:
222
- php-version: '8.0'
223
- tools: vimeo/psalm
224
- ```
225
-
226
- - To set up a particular version of a tool, specify it in the form `tool:version`.
227
-
228
- Version can be in the following format:
229
- - Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
230
- - Major version. For example `tool:1` or `tool:1.x`.
231
- - Major and minor version. For example `tool:1.2` or `tool:1.2.x`.
232
-
233
- When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
234
-
235
- Except for major versions of `composer`, For other tools when you specify only the `major` version or the version in `major.minor` format for any 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 `COMPOSER_TOKEN` environment variable.
236
-
237
- ```yaml
238
- - name: Setup PHP with tools
239
- uses: shivammathur/setup-php@v2
240
- with:
241
- php-version: '8.0'
242
- tools: php-cs-fixer:3, phpunit:8.5
243
- env:
244
- COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
245
- ```
246
-
247
- - The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format, Additionally for composer `snapshot` and `preview` can also be specified to set up the respective releases.
248
-
249
- ```yaml
250
- - name: Setup PHP with composer v2
251
- uses: shivammathur/setup-php@v2
252
- with:
253
- php-version: '8.0'
254
- tools: composer:v2
255
- ```
256
-
257
- - If you do not use composer in your workflow, you can specify `tools: none` to skip it.
258
-
259
- ```yaml
260
- - name: Setup PHP without composer
261
- uses: shivammathur/setup-php@v2
262
- with:
263
- php-version: '8.0'
264
- tools: none
265
- ```
266
-
267
- - Scripts `phpize` and `php-config` are set up with the same version as of the input PHP version.
268
-
269
- - The latest version of `blackfire` cli is set up when `blackfire` is specified in tools input. Please refer to the [official documentation](https://blackfire.io/docs/integrations/ci/github-actions "Blackfire.io documentation for GitHub Actions") for using `blackfire` with GitHub Actions.
270
-
271
- - Tools `prestissimo` and `composer-prefetcher` will be skipped unless `composer:v1` is also specified in tools input. It is recommended to drop `prestissimo` and use `composer v2`.
272
-
273
- - By default, tools which cannot be set up gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
274
-
275
- ```yaml
276
- - name: Setup PHP with fail-fast
277
- uses: shivammathur/setup-php@v2
278
- with:
279
- php-version: '8.0'
280
- tools: deployer
281
- env:
282
- fail-fast: true
283
- ```
284
-
285
- **Notes**
286
- - Input `tools` is useful to set up tools which you only use in GitHub Actions, thus keeping your `composer.json` tidy.
287
- - If you do not want to use all your dev-dependencies in GitHub Actions workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
288
- - If you have a tool in your `composer.json`, do not set up it with `tools` input as the two instances of the tool might conflict.
289
-
290
- ## :signal_strength: Coverage Support
291
-
292
- ### Xdebug
293
-
294
- Specify `coverage: xdebug` to use `Xdebug` and disable `PCOV`.
295
- Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
296
-
297
- ```yaml
298
- - name: Setup PHP with Xdebug
299
- uses: shivammathur/setup-php@v2
300
- with:
301
- php-version: '8.0'
302
- coverage: xdebug
303
- ```
304
-
305
- - The latest version of Xdebug compatible with the PHP version is set up by default.
306
- - If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify `coverage: xdebug2`.
307
-
308
- ```yaml
309
- - name: Setup PHP with Xdebug 2.x
310
- uses: shivammathur/setup-php@v2
311
- with:
312
- php-version: '7.4'
313
- coverage: xdebug2
314
- ```
315
-
316
- ### PCOV
317
-
318
- Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
319
- Runs on PHP 7.1 and newer PHP versions.
320
-
321
- - If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
322
-
323
- ```yaml
324
- - name: Setup PHP with PCOV
325
- uses: shivammathur/setup-php@v2
326
- with:
327
- php-version: '8.0'
328
- ini-values: pcov.directory=api #optional, see above for usage.
329
- coverage: pcov
330
- ```
331
-
332
- - PHPUnit 8.x and above supports PCOV out of the box.
333
- - If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up `pcov/clobber` before executing your tests.
334
-
335
- ```yaml
336
- - name: Setup PCOV
337
- run: |
338
- composer require pcov/clobber
339
- vendor/bin/pcov clobber
340
- ```
341
-
342
- ### Disable Coverage
343
-
344
- Specify `coverage: none` to remove both `Xdebug` and `PCOV`.
345
-
346
- Disable coverage for these reasons:
347
-
348
- - You are not generating coverage reports while testing.
349
- - It will remove `Xdebug`, which will have a positive impact on PHP performance.
350
- - You are using `phpdbg` for running your tests.
351
- - You are profiling your code using `blackfire`.
352
- - You are using PHP in JIT mode. Please refer to [JIT configuration](#jit-configuration) section for more details.
353
-
354
- ```yaml
355
- - name: Setup PHP with no coverage driver
356
- uses: shivammathur/setup-php@v2
357
- with:
358
- php-version: '8.0'
359
- coverage: none
360
- ```
361
-
362
- ## :memo: Usage
363
-
364
- ### Inputs
365
-
366
- > Specify using `with` keyword
367
-
368
- #### `php-version` (required)
369
-
370
- - Specify the PHP version you want to set up.
371
- - Accepts a `string`. For example `'8.0'`.
372
- - Accepts `latest` to set up the latest stable PHP version.
373
- - Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
374
- - See [PHP support](#tada-php-support) for supported PHP versions.
375
-
376
- #### `extensions` (optional)
377
-
378
- - Specify the extensions you want to add or remove.
379
- - Accepts a `string` in csv-format. For example `mbstring, :opcache`.
380
- - Non-default extensions prefixed with `:` are removed.
381
- - See [PHP extension support](#heavy_plus_sign-php-extension-support) for more info.
382
-
383
- #### `ini-values` (optional)
384
-
385
- - Specify the values you want to add to `php.ini`.
386
- - Accepts a `string` in csv-format. For example `post_max_size=256M, max_execution_time=180`.
387
- - Accepts ini values with commas if wrapped in quotes. For example `xdebug.mode="develop,coverage"`.
388
-
389
- #### `coverage` (optional)
390
-
391
- - Specify the code coverage driver you want to set up.
392
- - Accepts `xdebug`, `pcov` or `none`.
393
- - See [coverage support](#signal_strength-coverage-support) for more info.
394
-
395
- #### `tools` (optional)
396
-
397
- - Specify the tools you want to set up.
398
- - Accepts a `string` in csv-format. For example: `phpunit, phpcs`
399
- - See [tools Support](#wrench-tools-support) for tools supported.
400
-
401
- ### Outputs
402
-
403
- #### `php-version`
404
-
405
- To use outputs, give the `setup-php` step an `id`, you can use the same to get the outputs in a later step.
406
-
407
- - Provides the PHP version in semver format.
408
-
409
- ```yaml
410
- - name: Setup PHP
411
- id: setup-php
412
- uses: shivammathur/setup-php@v2
413
- with:
414
- php-version: '8.0'
415
-
416
- - name: Print PHP version
417
- run: echo ${{ steps.setup-php.outputs.php-version }}
418
- ```
419
-
420
- ### Flags
421
-
422
- > Specify using `env` keyword
423
-
424
- #### `fail-fast` (optional)
425
-
426
- - Specify to mark the workflow as failed if an extension or tool fails to set up.
427
- - This changes the default mode from graceful warnings to fail-fast.
428
- - By default, it is set to `false`.
429
- - Accepts `true` and `false`.
430
-
431
- #### `phpts` (optional)
432
-
433
- - Specify to set up thread-safe version of PHP on Windows.
434
- - Accepts `ts` and `nts`.
435
- - By default, it is set to `nts`.
436
- - See [thread safe setup](#thread-safe-setup) for more info.
437
-
438
- #### `update` (optional)
439
-
440
- - Specify to update PHP on the runner to the latest patch version.
441
- - Accepts `true` and `false`.
442
- - By default, it is set to `false`.
443
- - See [force update setup](#force-update-setup) for more info.
444
-
445
- See below for more info.
446
-
447
- ### Basic Setup
448
-
449
- > Setup a particular PHP version.
450
-
451
- ```yaml
452
- steps:
453
- - name: Setup PHP
454
- uses: shivammathur/setup-php@v2
455
- with:
456
- php-version: '8.0'
457
- extensions: mbstring, intl
458
- ini-values: post_max_size=256M, max_execution_time=180
459
- coverage: xdebug
460
- tools: php-cs-fixer, phpunit
461
- ```
462
-
463
- ### Matrix Setup
464
-
465
- > Setup multiple PHP versions on multiple operating systems.
466
-
467
- ```yaml
468
- jobs:
469
- run:
470
- runs-on: ${{ matrix.operating-system }}
471
- strategy:
472
- matrix:
473
- operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
474
- php-versions: ['7.3', '7.4', '8.0']
475
- phpunit-versions: ['latest']
476
- include:
477
- - operating-system: 'ubuntu-latest'
478
- php-versions: '7.2'
479
- phpunit-versions: '8.5.19'
480
- steps:
481
- - name: Setup PHP
482
- uses: shivammathur/setup-php@v2
483
- with:
484
- php-version: ${{ matrix.php-versions }}
485
- extensions: mbstring, intl
486
- ini-values: post_max_size=256M, max_execution_time=180
487
- coverage: xdebug
488
- tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
489
- ```
490
-
491
- ### Nightly Build Setup
492
-
493
- > Setup a nightly build of `PHP 8.1`.
494
-
495
- - This version is currently in development.
496
- - Some user space extensions might not support this version currently.
497
-
498
- ```yaml
499
- steps:
500
- - name: Setup nightly PHP
501
- uses: shivammathur/setup-php@v2
502
- with:
503
- php-version: '8.1'
504
- extensions: mbstring
505
- ini-values: post_max_size=256M, max_execution_time=180
506
- coverage: xdebug
507
- tools: php-cs-fixer, phpunit
508
- ```
509
-
510
- ### Thread Safe Setup
511
-
512
- > Setup `TS` or `NTS` PHP on `Windows`.
513
-
514
- - `NTS` versions are set up by default.
515
- - On `Ubuntu` and `macOS` only `NTS` versions are supported.
516
- - On `Windows` both `TS` and `NTS` versions are supported.
517
-
518
- ```yaml
519
- jobs:
520
- run:
521
- runs-on: windows-latest
522
- name: Setup PHP TS on Windows
523
- steps:
524
- - name: Setup PHP
525
- uses: shivammathur/setup-php@v2
526
- with:
527
- php-version: '8.0'
528
- env:
529
- phpts: ts # specify ts or nts
530
- ```
531
-
532
- ### Force Update Setup
533
-
534
- > Update to the latest patch of PHP versions.
535
-
536
- - Pre-installed PHP versions on the GitHub Actions images are not updated to their latest patch release by default.
537
- - You can specify the `update` environment variable to `true` for updating to the latest release.
538
-
539
- ```yaml
540
- - name: Setup PHP with latest versions
541
- uses: shivammathur/setup-php@v2
542
- with:
543
- php-version: '8.0'
544
- env:
545
- update: true # specify true or false
546
- ```
547
-
548
- ### Verbose Setup
549
-
550
- > Debug your workflow
551
-
552
- To debug any issues, you can use the `verbose` tag instead of `v2`.
553
-
554
- ```yaml
555
- - name: Setup PHP with logs
556
- uses: shivammathur/setup-php@verbose
557
- with:
558
- php-version: '8.0'
559
- ```
560
-
561
- ### Multi-Arch Setup
562
-
563
- > Setup PHP on multiple architecture on Ubuntu GitHub Runners.
564
-
565
- - `PHP 5.6` to `PHP 8.0` are supported by `setup-php` on multiple architecture on `Ubuntu`.
566
- - For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` installed for JavaScript based GitHub Actions.
567
- - Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup).
568
-
569
- ```yaml
570
- jobs:
571
- run:
572
- runs-on: ubuntu-latest
573
- container: shivammathur/node:latest-${{ matrix.arch }}
574
- strategy:
575
- matrix:
576
- arch: ["amd64", "i386"]
577
- steps:
578
- - name: Install PHP
579
- uses: shivammathur/setup-php@v2
580
- with:
581
- php-version: '8.0'
582
- ```
583
-
584
- ### Self Hosted Setup
585
-
586
- > Setup PHP on a self-hosted runner.
587
-
588
- - To set up a containerised self-hosted runner, refer to the following guides as per your base operating system.
589
- - [Linux](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Linux)
590
- - [Windows](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows)
591
-
592
- - To set up the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
593
- - If your workflow uses [service containers](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices "GitHub Actions Services"), then set up the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.
594
-
595
- Specify the environment variable `runner` with the value `self-hosted`. Without this your workflow will fail.
596
-
597
- ```yaml
598
- jobs:
599
- run:
600
- runs-on: self-hosted
601
- strategy:
602
- matrix:
603
- php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
604
- name: PHP ${{ matrix.php-versions }}
605
- steps:
606
- - name: Checkout
607
- uses: actions/checkout@v2
608
-
609
- - name: Setup PHP
610
- uses: shivammathur/setup-php@v2
611
- with:
612
- php-version: ${{ matrix.php-versions }}
613
- env:
614
- runner: self-hosted # Specify the runner.
615
- ```
616
-
617
- **Notes**
618
- - Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
619
- - Do not set up self-hosted runners on the side on your development environment or your production server.
620
- - Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
621
-
622
- ### Local Testing Setup
623
-
624
- > Test your `Ubuntu` workflow locally using [`nektos/act`](https://github.com/nektos/act "Project to test GitHub Actions locally").
625
-
626
- ```yaml
627
- jobs:
628
- run:
629
- runs-on: ubuntu-latest
630
- steps:
631
- - name: Setup PHP
632
- uses: shivammathur/setup-php@v2
633
- with:
634
- php-version: '8.0'
635
- ```
636
-
637
- Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
638
-
639
- Choose the image tag which matches the `runs-on` property in your workflow. For example, if you are using `ubuntu-20.04` in your workflow, run `act -P ubuntu-20.04=shivammathur/node:20.04`.
640
-
641
- ```bash
642
- # For runs-on: ubuntu-latest
643
- act -P ubuntu-latest=shivammathur/node:latest
644
-
645
- # For runs-on: ubuntu-20.04
646
- act -P ubuntu-20.04=shivammathur/node:2004
647
-
648
- # For runs-on: ubuntu-18.04
649
- act -P ubuntu-18.04=shivammathur/node:1804
650
- ```
651
-
652
- ### JIT Configuration
653
-
654
- > Enable Just-in-time(JIT) on PHP 8.0 and PHP 8.1.
655
-
656
- - To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`.
657
- - JIT conflicts with `Xdebug`, `PCOV`, and other extensions which override `zend_execute_ex` function, so set `coverage: none` and remove any such extension if added.
658
- - By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` are set which can be changed using `ini-values` input.
659
- - 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").
660
-
661
- For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
662
-
663
- ```yaml
664
- - name: Setup PHP with JIT in tracing mode
665
- uses: shivammathur/setup-php@v2
666
- with:
667
- php-version: '8.0'
668
- coverage: none
669
- ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
670
- ```
671
-
672
- ### Cache Extensions
673
-
674
- You can cache PHP extensions using `shivammathur/cache-extensions` and `action/cache` GitHub Actions. Extensions which take very long to set up when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
675
- Refer to [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") for details.
676
-
677
- ### Cache Composer Dependencies
678
-
679
- If your project uses composer, you can persist the composer's internal cache directory. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
680
-
681
- ```yaml
682
- - name: Get composer cache directory
683
- id: composer-cache
684
- run: echo "::set-output name=dir::$(composer config cache-files-dir)"
685
-
686
- - name: Cache dependencies
687
- uses: actions/cache@v2
688
- with:
689
- path: ${{ steps.composer-cache.outputs.dir }}
690
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
691
- restore-keys: ${{ runner.os }}-composer-
692
-
693
- - name: Install dependencies
694
- run: composer install --prefer-dist
695
- ```
696
-
697
- **Notes**
698
- - Please do not cache `vendor` directory using `action/cache` as that will have side effects.
699
- - If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
700
- ```yaml
701
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
702
- ```
703
-
704
- - If you support a range of `composer` dependencies and use `prefer-lowest` and `prefer-stable` options, you can store them in your matrix and add them to the keys.
705
- ```yaml
706
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.prefer }}-
707
- restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
708
- ```
709
-
710
- ### Composer GitHub OAuth
711
-
712
- If you have a number of workflows which set up multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. Also, if you specify only the major version or the version in `major.minor` format, you can hit the rate limit. To avoid this you can specify an `OAuth` token by setting `COMPOSER_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
713
-
714
- ```yaml
715
- - name: Setup PHP
716
- uses: shivammathur/setup-php@v2
717
- with:
718
- php-version: '8.0'
719
- env:
720
- COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
721
- ```
722
-
723
- ### Inline PHP Scripts
724
-
725
- If you have to run multiple lines of PHP code in your workflow, you can do that easily without saving it to a file.
726
-
727
- Put the code in the run property of a step and specify the shell as `php {0}`.
728
-
729
- ```yaml
730
- - name: Setup PHP
731
- uses: shivammathur/setup-php@v2
732
- with:
733
- php-version: '8.0'
734
-
735
- - name: Run PHP code
736
- shell: php {0}
737
- run: |
738
- <?php
739
- $welcome = "Hello, world";
740
- echo $welcome;
741
- ```
742
-
743
- ### Problem Matchers
744
-
745
- Problem matchers are `json` configurations which identify errors and warnings in your logs and surface them prominently in the GitHub Actions UI by highlighting them and creating code annotations.
746
-
747
- #### PHP
748
-
749
- Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step.
750
-
751
- ```yaml
752
- - name: Setup problem matchers for PHP
753
- run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
754
- ```
755
-
756
- #### PHPUnit
757
-
758
- Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step.
759
-
760
- ```yaml
761
- - name: Setup problem matchers for PHPUnit
762
- run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
763
- ```
764
-
765
- #### PHPStan
766
-
767
- PHPStan supports error reporting in GitHub Actions, so it does not require problem matchers.
768
-
769
- ```yaml
770
- - name: Setup PHP
771
- uses: shivammathur/setup-php@v2
772
- with:
773
- php-version: '8.0'
774
- tools: phpstan
775
-
776
- - name: Run PHPStan
777
- run: phpstan analyse src
778
- ```
779
-
780
- #### Psalm
781
-
782
- Psalm supports error reporting in GitHub Actions with an output format `github`.
783
-
784
- ```yaml
785
- - name: Setup PHP
786
- uses: shivammathur/setup-php@v2
787
- with:
788
- php-version: '8.0'
789
- tools: psalm
790
-
791
- - name: Run Psalm
792
- run: psalm --output-format=github
793
- ```
794
-
795
- #### Tools with checkstyle support
796
-
797
- For tools that support `checkstyle` reporting like `phpstan`, `psalm`, `php-cs-fixer` and `phpcs` you can use `cs2pr` to annotate your code.
798
- For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
799
-
800
- > Here is an example with `phpcs`.
801
-
802
- ```yaml
803
- - name: Setup PHP
804
- uses: shivammathur/setup-php@v2
805
- with:
806
- php-version: '8.0'
807
- tools: cs2pr, phpcs
808
-
809
- - name: Run phpcs
810
- run: phpcs -q --report=checkstyle src | cs2pr
811
- ```
812
-
813
- ### Examples
814
-
815
- Examples of using `setup-php` with various PHP Frameworks and Packages.
816
-
817
- |Framework/Package|Runs on|Workflow|
818
- |--- |--- |--- |
819
- |Blackfire|`macOS`, `ubuntu` and `windows`|[blackfire.yml](./examples/blackfire.yml "GitHub Action using Blackfire")|
820
- |Blackfire Player|`macOS`, `ubuntu` and `windows`|[blackfire-player.yml](./examples/blackfire-player.yml "GitHub Action using Blackfire Player")|
821
- |CakePHP with `MySQL` and `Redis`|`ubuntu`|[cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis")|
822
- |CakePHP with `PostgreSQL` and `Redis`|`ubuntu`|[cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis")|
823
- |CakePHP without services|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services")|
824
- |CodeIgniter|`macOS`, `ubuntu` and `windows`|[codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter")|
825
- |Laravel with `MySQL` and `Redis`|`ubuntu`|[laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis")|
826
- |Laravel with `PostgreSQL` and `Redis`|`ubuntu`|[laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis")|
827
- |Laravel without services|`macOS`, `ubuntu` and `windows`|[laravel.yml](./examples/laravel.yml "GitHub Action for Laravel without services")|
828
- |Lumen with `MySQL` and `Redis`|`ubuntu`|[lumen-mysql.yml](./examples/lumen-mysql.yml "GitHub Action for Lumen with MySQL and Redis")|
829
- |Lumen with `PostgreSQL` and `Redis`|`ubuntu`|[lumen-postgres.yml](./examples/lumen-postgres.yml "GitHub Action for Lumen with PostgreSQL and Redis")|
830
- |Lumen without services|`macOS`, `ubuntu` and `windows`|[lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services")|
831
- |Phalcon with `MySQL`|`ubuntu`|[phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL")|
832
- |Phalcon with `PostgreSQL`|`ubuntu`|[phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL")|
833
- |Roots/bedrock|`ubuntu`|[bedrock.yml](./examples/bedrock.yml "GitHub Action for Wordpress Development using @roots/bedrock")|
834
- |Roots/sage|`ubuntu`|[sage.yml](./examples/sage.yml "GitHub Action for Wordpress Development using @roots/sage")|
835
- |Slim Framework|`macOS`, `ubuntu` and `windows`|[slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework")|
836
- |Symfony with `MySQL`|`ubuntu`|[symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL")|
837
- |Symfony with `PostgreSQL`|`ubuntu`|[symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL")|
838
- |Symfony without services|`macOS`, `ubuntu` and `windows`|[symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services")|
839
- |Yii2 Starter Kit with `MySQL`|`ubuntu`|[yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL")|
840
- |Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")|
841
- |Zend Framework|`macOS`, `ubuntu` and `windows`|[zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework")|
842
-
843
- ## :bookmark: Versioning
844
-
845
- - 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. For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
846
- - 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.
847
- - 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.
848
- - It is highly discouraged to use the `master` branch as version, it might break your workflow after major releases as they have breaking changes.
849
- - 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.
850
-
851
- ## :scroll: License
852
-
853
- - The scripts and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/setup-php").
854
- - This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
855
- - 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").
856
-
857
- ## :+1: Contributions
858
-
859
- > Contributions are welcome!
860
-
861
- - See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide") before you start.
862
- - If you face any issues or want to suggest a feature/improvement, start a discussion [here](https://github.com/shivammathur/setup-php/discussions "Setup PHP discussions").
863
-
864
- *Contributors of `setup-php` and other related projects*
865
-
866
- <p align="center">
867
- <a href="https://github.com/shivammathur/setup-php/graphs/contributors">
868
- <img src="https://setup-php.com/contributors/?" alt="Contributors of setup-php and related projects" width="100%">
869
- </a>
870
- </p>
871
-
872
- ## :sparkling_heart: Support This Project
873
-
874
- - This project is provided as Free and Open-Source software. We need funds to maintain and do future improvements. Please sponsor setup-php using the below options:
875
- - [Open Collective](https://opencollective.com/setup-php "setup-php Open Collective")
876
- - [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal")
877
- - [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon")
878
- - Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
879
- - Please star the project and share it. If you blog, please share your experience of using this action.
880
-
881
- *`setup-php` is generously supported by*
882
-
883
- <p>
884
- <a href="https://www.jetbrains.com/?from=setup-php">
885
- <img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
886
- </a>
887
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
888
- <a href="https://blackfire.io/?utm_source=setup-php">
889
- <img src="https://setup-php.com/sponsors//blackfire.svg" alt="Blackfire" width="212" height="60">
890
- </a>
891
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
892
- <a href="https://www.macstadium.com/?source=setup-php">
893
- <img src="https://setup-php.com/sponsors//macstadium.png" alt="Mac Stadium" width="148" height="60">
894
- </a>
895
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
896
- <a href="https://tidelift.com/subscription/pkg/npm-setup-php">
897
- <img src="https://setup-php.com/sponsors//tidelift.png" alt="Tidelift" width="70" height="60">
898
- </a>
899
- </p>
900
-
901
- ## :package: Dependencies
902
-
903
- - [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
904
- - [aaronparker/VcRedist](https://github.com/aaronparker/VcRedist "VcRedist PowerShell package")
905
- - [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
906
- - [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
907
- - [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions")
908
- - [shivammathur/composer-cache](https://github.com/shivammathur/composer-cache "Cache composer releases")
909
- - [shivammathur/homebrew-extensions](https://github.com/shivammathur/homebrew-extensions "Tap for PHP extensions on MacOS")
910
- - [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds on MacOS")
911
- - [shivammathur/icu-intl](https://github.com/shivammathur/icu-intl "icu4c and php-intl builds")
912
- - [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package for Ubuntu")
913
- - [shivammathur/php-builder-windows](https://github.com/shivammathur/php-builder-windows "Nightly PHP package for Windows")
914
- - [shivammathur/php-ubuntu](https://github.com/shivammathur/php-ubuntu "Cache stable PHP Packages for Ubuntu")
915
- - [shivammathur/php5-darwin](https://github.com/shivammathur/php5-darwin "Scripts to set up PHP5 versions on darwin")
916
- - [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to set up PHP5 versions on ubuntu")
917
-
918
- ## :bookmark_tabs: Further Reading
919
-
920
- - [About GitHub Actions](https://github.com/features/actions "GitHub Actions")
921
- - [GitHub Actions Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions "GitHub Actions Syntax")
922
- - [Other Awesome Actions](https://github.com/sdras/awesome-actions "List of Awesome GitHub Actions")
1
+ <p align="center">
2
+ <a href="https://github.com/marketplace/actions/setup-php-action" target="_blank">
3
+ <img src="https://repository-images.githubusercontent.com/206578964/e0a18480-dc65-11e9-8dd3-b9ffbf5575fe" alt="Setup PHP in GitHub Actions" width="400">
4
+ </a>
5
+ </p>
6
+
7
+ <h1 align="center">Setup PHP in GitHub Actions</h1>
8
+
9
+ <p align="center">
10
+ <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>
11
+ <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>
12
+ <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>
13
+ <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.2-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
14
+ </p>
15
+ <p align="center">
16
+ <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>
17
+ <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>
18
+ <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>
19
+ </p>
20
+
21
+ 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.
22
+
23
+ ## Contents
24
+
25
+ - [OS/Platform Support](#cloud-osplatform-support)
26
+ - [GitHub-Hosted Runners](#github-hosted-runners)
27
+ - [Self-Hosted Runners](#self-hosted-runners)
28
+ - [PHP Support](#tada-php-support)
29
+ - [PHP Extension Support](#heavy_plus_sign-php-extension-support)
30
+ - [Tools Support](#wrench-tools-support)
31
+ - [Coverage Support](#signal_strength-coverage-support)
32
+ - [Xdebug](#xdebug)
33
+ - [PCOV](#pcov)
34
+ - [Disable Coverage](#disable-coverage)
35
+ - [Usage](#memo-usage)
36
+ - [Inputs](#inputs)
37
+ - [Outputs](#outputs)
38
+ - [Flags](#flags)
39
+ - [Basic Setup](#basic-setup)
40
+ - [Matrix Setup](#matrix-setup)
41
+ - [Nightly Build Setup](#nightly-build-setup)
42
+ - [Thread Safe Setup](#thread-safe-setup)
43
+ - [Force Update Setup](#force-update-setup)
44
+ - [Verbose Setup](#verbose-setup)
45
+ - [Multi-Arch Setup](#multi-arch-setup)
46
+ - [Self Hosted Setup](#self-hosted-setup)
47
+ - [Local Testing Setup](#local-testing-setup)
48
+ - [JIT Configuration](#jit-configuration)
49
+ - [Cache Extensions](#cache-extensions)
50
+ - [Cache Composer Dependencies](#cache-composer-dependencies)
51
+ - [Composer GitHub OAuth](#composer-github-oauth)
52
+ - [Inline PHP Scripts](#inline-php-scripts)
53
+ - [Problem Matchers](#problem-matchers)
54
+ - [Examples](#examples)
55
+ - [Versioning](#bookmark-versioning)
56
+ - [License](#scroll-license)
57
+ - [Contributions](#1-contributions)
58
+ - [Support This Project](#sparkling_heart-support-this-project)
59
+ - [Dependencies](#package-dependencies)
60
+ - [Further Reading](#bookmark_tabs-further-reading)
61
+
62
+ ## :cloud: OS/Platform Support
63
+
64
+ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on the following OS/Platforms.
65
+
66
+ ### GitHub-Hosted Runners
67
+
68
+ | Virtual environment | YAML workflow label | Pre-installed PHP |
69
+ |-----------------------|------------------------------------|------------------------|
70
+ | Ubuntu 20.04 | `ubuntu-latest` or `ubuntu-20.04` | `PHP 7.4` to `PHP 8.1` |
71
+ | Ubuntu 18.04 | `ubuntu-18.04` | `PHP 7.1` to `PHP 8.1` |
72
+ | Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.1` |
73
+ | Windows Server 2019 | `windows-2019` | `PHP 8.1` |
74
+ | macOS Big Sur 11.x | `macos-11` | `PHP 8.1` |
75
+ | macOS Catalina 10.15 | `macos-latest` or `macos-10.15` | `PHP 8.1` |
76
+
77
+ ### Self-Hosted Runners
78
+
79
+ | Host OS/Virtual environment | YAML workflow label |
80
+ |----------------------------------|----------------------------|
81
+ | Ubuntu 21.04 | `self-hosted` or `Linux` |
82
+ | Ubuntu 20.04 | `self-hosted` or `Linux` |
83
+ | Ubuntu 18.04 | `self-hosted` or `Linux` |
84
+ | Debian 11 | `self-hosted` or `Linux` |
85
+ | Debian 10 | `self-hosted` or `Linux` |
86
+ | Debian 9 | `self-hosted` or `Linux` |
87
+ | Windows 7 and newer | `self-hosted` or `Windows` |
88
+ | Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
89
+ | macOS Monterey 12.x x86_64/arm64 | `self-hosted` or `macOS` |
90
+ | macOS Big Sur 11.x x86_64/arm64 | `self-hosted` or `macOS` |
91
+ | macOS Catalina 10.15 | `self-hosted` or `macOS` |
92
+
93
+ - Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
94
+ - Operating systems based on the above Ubuntu and Debian versions are also supported on best effort basis.
95
+ - If the requested PHP version is pre-installed, `setup-php` switches to it, otherwise it installs the PHP version.
96
+
97
+ ## :tada: PHP Support
98
+
99
+ On all supported OS/Platforms the following PHP versions are supported as per the runner.
100
+
101
+ - PHP 5.3 to PHP 8.2 on GitHub-hosted runners.
102
+ - PHP 5.6 to PHP 8.2 on self-hosted runners.
103
+
104
+ | PHP Version | Stability | Release Support | Runner Support |
105
+ |-------------|-----------|-----------------------|--------------------------------|
106
+ | `5.3` | `Stable` | `End of life` | `GitHub-hosted` |
107
+ | `5.4` | `Stable` | `End of life` | `GitHub-hosted` |
108
+ | `5.5` | `Stable` | `End of life` | `GitHub-hosted` |
109
+ | `5.6` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
110
+ | `7.0` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
111
+ | `7.1` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
112
+ | `7.2` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
113
+ | `7.3` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
114
+ | `7.4` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
115
+ | `8.0` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
116
+ | `8.1` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
117
+ | `8.2` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
118
+
119
+ **Notes:**
120
+ - Specifying `8.2` in `php-version` input installs a nightly build of `PHP 8.2.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
121
+ - To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
122
+
123
+ ## :heavy_plus_sign: PHP Extension Support
124
+
125
+ PHP extensions can be set up using the `extensions` input. It accepts a `string` in csv-format.
126
+
127
+ - On `Ubuntu`, extensions which are available as a package, available on `PECL` or a git repository can be set up.
128
+
129
+ ```yaml
130
+ - name: Setup PHP with PECL extension
131
+ uses: shivammathur/setup-php@v2
132
+ with:
133
+ php-version: '8.1'
134
+ extensions: imagick, swoole
135
+ ```
136
+
137
+ - On `Windows`, extensions available on `PECL` which have the `DLL` binary can be set up.
138
+
139
+ - On `macOS`, extensions available on `PECL` or a git repository can be set up.
140
+
141
+ - On `Ubuntu` and `macOS` to compile and install an extension from a git repository follow this [guide](https://github.com/shivammathur/setup-php/wiki/Add-extension-from-source "Guide to compile and install PHP extensions in setup-php").
142
+
143
+ - Extensions installed along with PHP if specified are enabled.
144
+
145
+ - Specific versions of extensions available on `PECL` can be set up by suffixing the extension's name with the version. This is useful for installing old versions of extensions which support end of life PHP versions.
146
+
147
+ ```yaml
148
+ - name: Setup PHP with specific version of PECL extension
149
+ uses: shivammathur/setup-php@v2
150
+ with:
151
+ php-version: '5.4'
152
+ extensions: swoole-1.9.3
153
+ ```
154
+
155
+ - Extensions with pre-release versions available on `PECL` can be set up by suffixing the extension's name with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
156
+
157
+ ```yaml
158
+ - name: Setup PHP with pre-release PECL extension
159
+ uses: shivammathur/setup-php@v2
160
+ with:
161
+ php-version: '8.1'
162
+ extensions: xdebug-beta
163
+ ```
164
+
165
+ - Shared extensions can be disabled by prefixing them with a `:`. All extensions depending on the specified extension will also be disabled.
166
+
167
+ ```yaml
168
+ - name: Setup PHP and disable opcache
169
+ uses: shivammathur/setup-php@v2
170
+ with:
171
+ php-version: '8.1'
172
+ extensions: :opcache
173
+ ```
174
+
175
+ - 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.
176
+
177
+ **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.
178
+
179
+ ```yaml
180
+ - name: Setup PHP without any shared extensions except mbstring
181
+ uses: shivammathur/setup-php@v2
182
+ with:
183
+ php-version: '8.1'
184
+ extensions: none, mbstring
185
+ ```
186
+
187
+ - Extension `intl` can be set up with specific `ICU` version for `PHP 5.6` and above in `Ubuntu` workflows by suffixing `intl` with the `ICU` version. `ICU 50.2` and newer versions are supported. Refer to [`ICU builds`](https://github.com/shivammathur/icu-intl#icu4c-builds) for the specific versions supported.
188
+
189
+ ```yaml
190
+ - name: Setup PHP with intl
191
+ uses: shivammathur/setup-php@v2
192
+ with:
193
+ php-version: '8.1'
194
+ extensions: intl-70.1
195
+ ```
196
+
197
+ - Extensions loaded by default after `setup-php` runs can be found on the [wiki](https://github.com/shivammathur/setup-php/wiki).
198
+
199
+ - These extensions have custom support:
200
+ - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`.
201
+ - `geos` on `Ubuntu` and `macOS`.
202
+ - `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_oci`, `pecl_http`, `phalcon3` and `phalcon4` on all supported OS.
203
+
204
+ - By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
205
+
206
+ ```yaml
207
+ - name: Setup PHP with fail-fast
208
+ uses: shivammathur/setup-php@v2
209
+ with:
210
+ php-version: '8.1'
211
+ extensions: oci8
212
+ env:
213
+ fail-fast: true
214
+ ```
215
+
216
+ ## :wrench: Tools Support
217
+
218
+ These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
219
+
220
+ [`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`], [`prestissimo`], [`protoc`], [`psalm`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
221
+
222
+ ```yaml
223
+ - name: Setup PHP with tools
224
+ uses: shivammathur/setup-php@v2
225
+ with:
226
+ php-version: '8.1'
227
+ tools: php-cs-fixer, phpunit
228
+ ```
229
+
230
+ - In addition to above tools any composer tool or package can also be set up globally by specifying it as `vendor/package` matching the listing on Packagist. This format accepts the same [version constraints](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints "Composer version constraints") as `composer`.
231
+
232
+ ```yaml
233
+ - name: Setup PHP with tools
234
+ uses: shivammathur/setup-php@v2
235
+ with:
236
+ php-version: '8.1'
237
+ tools: vimeo/psalm
238
+ ```
239
+
240
+ - To set up a particular version of a tool, specify it in the form `tool:version`.
241
+
242
+ Version can be in the following format:
243
+ - Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
244
+ - Major version. For example `tool:1` or `tool:1.x`.
245
+ - Major and minor version. For example `tool:1.2` or `tool:1.2.x`.
246
+
247
+ When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
248
+
249
+ Except for major versions of `composer`, For other tools when you specify only the `major` version or the version in `major.minor` format for any 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 `COMPOSER_TOKEN` environment variable.
250
+
251
+ ```yaml
252
+ - name: Setup PHP with tools
253
+ uses: shivammathur/setup-php@v2
254
+ with:
255
+ php-version: '8.1'
256
+ tools: php-cs-fixer:3.5, phpunit:9.5
257
+ env:
258
+ COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
259
+ ```
260
+
261
+ - The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format, Additionally for composer `snapshot` and `preview` can also be specified to set up the respective releases.
262
+
263
+ ```yaml
264
+ - name: Setup PHP with composer v2
265
+ uses: shivammathur/setup-php@v2
266
+ with:
267
+ php-version: '8.1'
268
+ tools: composer:v2
269
+ ```
270
+
271
+ - If you do not use composer in your workflow, you can specify `tools: none` to skip it.
272
+
273
+ ```yaml
274
+ - name: Setup PHP without composer
275
+ uses: shivammathur/setup-php@v2
276
+ with:
277
+ php-version: '8.1'
278
+ tools: none
279
+ ```
280
+
281
+ - Tools `pear`, `pecl`, `phpize` and `php-config` are set up by default for all supported PHP versions on Linux and macOS.
282
+
283
+ - The latest version of `blackfire` cli is set up when `blackfire` is specified in tools input. Please refer to the [official documentation](https://blackfire.io/docs/integrations/ci/github-actions "Blackfire.io documentation for GitHub Actions") for using `blackfire` with GitHub Actions.
284
+
285
+ - Tools `prestissimo` and `composer-prefetcher` will be skipped unless `composer:v1` is also specified in tools input. It is recommended to drop `prestissimo` and use `composer v2`.
286
+
287
+ - By default, expect `composer` tools which cannot be set up gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
288
+
289
+ ```yaml
290
+ - name: Setup PHP with fail-fast
291
+ uses: shivammathur/setup-php@v2
292
+ with:
293
+ php-version: '8.1'
294
+ tools: deployer
295
+ env:
296
+ fail-fast: true
297
+ ```
298
+
299
+ **Notes**
300
+ - Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
301
+ - 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.
302
+ - 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`.
303
+
304
+ ## :signal_strength: Coverage Support
305
+
306
+ ### Xdebug
307
+
308
+ Specify `coverage: xdebug` to use `Xdebug` and disable `PCOV`.
309
+ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
310
+
311
+ ```yaml
312
+ - name: Setup PHP with Xdebug
313
+ uses: shivammathur/setup-php@v2
314
+ with:
315
+ php-version: '8.1'
316
+ coverage: xdebug
317
+ ```
318
+
319
+ - When you specify `coverage: xdebug`, the latest version of Xdebug compatible with the PHP version is set up by default.
320
+ - If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify `coverage: xdebug2`.
321
+
322
+ ```yaml
323
+ - name: Setup PHP with Xdebug 2.x
324
+ uses: shivammathur/setup-php@v2
325
+ with:
326
+ php-version: '7.4'
327
+ coverage: xdebug2
328
+ ```
329
+
330
+ **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.
331
+
332
+ ### PCOV
333
+
334
+ Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
335
+ Runs on PHP 7.1 and newer PHP versions.
336
+
337
+ - If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
338
+
339
+ ```yaml
340
+ - name: Setup PHP with PCOV
341
+ uses: shivammathur/setup-php@v2
342
+ with:
343
+ php-version: '8.1'
344
+ ini-values: pcov.directory=api #optional, see above for usage.
345
+ coverage: pcov
346
+ ```
347
+
348
+ - PHPUnit 8.x and above supports PCOV out of the box.
349
+ - If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up `pcov/clobber` before executing your tests.
350
+
351
+ ```yaml
352
+ - name: Setup PCOV
353
+ run: |
354
+ composer require pcov/clobber
355
+ vendor/bin/pcov clobber
356
+ ```
357
+
358
+ ### Disable Coverage
359
+
360
+ Specify `coverage: none` to disable both `Xdebug` and `PCOV`.
361
+
362
+ Disable coverage for these reasons:
363
+
364
+ - You are not generating coverage reports while testing.
365
+ - You are using `phpdbg` for running your tests.
366
+ - You are profiling your code using `blackfire`.
367
+ - You are using PHP in JIT mode. Please refer to [JIT configuration](#jit-configuration) section for more details.
368
+
369
+ ```yaml
370
+ - name: Setup PHP with no coverage driver
371
+ uses: shivammathur/setup-php@v2
372
+ with:
373
+ php-version: '8.1'
374
+ coverage: none
375
+ ```
376
+
377
+ ## :memo: Usage
378
+
379
+ ### Inputs
380
+
381
+ > Specify using `with` keyword
382
+
383
+ #### `php-version` (required)
384
+
385
+ - Specify the PHP version you want to set up.
386
+ - Accepts a `string`. For example `'8.0'`.
387
+ - Accepts `latest` to set up the latest stable PHP version.
388
+ - Accepts `nightly` to set up a nightly build from the master branch of PHP.
389
+ - Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
390
+ - See [PHP support](#tada-php-support) for supported PHP versions.
391
+
392
+ #### `extensions` (optional)
393
+
394
+ - Specify the extensions you want to add or disable.
395
+ - Accepts a `string` in csv-format. For example `mbstring, :opcache`.
396
+ - Accepts `none` to disable all shared extensions.
397
+ - Shared extensions prefixed with `:` are disabled.
398
+ - See [PHP extension support](#heavy_plus_sign-php-extension-support) for more info.
399
+
400
+ #### `ini-file` (optional)
401
+
402
+ - Specify the base `php.ini` file.
403
+ - Accepts `production`, `development` or `none`.
404
+ - By default, production `php.ini` file is used.
405
+
406
+ #### `ini-values` (optional)
407
+
408
+ - Specify the values you want to add to `php.ini`.
409
+ - Accepts a `string` in csv-format. For example `post_max_size=256M, max_execution_time=180`.
410
+ - Accepts ini values with commas if wrapped in quotes. For example `xdebug.mode="develop,coverage"`.
411
+
412
+ #### `coverage` (optional)
413
+
414
+ - Specify the code-coverage driver you want to set up.
415
+ - Accepts `xdebug`, `pcov` or `none`.
416
+ - See [coverage support](#signal_strength-coverage-support) for more info.
417
+
418
+ #### `tools` (optional)
419
+
420
+ - Specify the tools you want to set up.
421
+ - Accepts a `string` in csv-format. For example: `phpunit, phpcs`
422
+ - See [tools Support](#wrench-tools-support) for tools supported.
423
+
424
+ ### Outputs
425
+
426
+ #### `php-version`
427
+
428
+ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the same to get the outputs in a later step.
429
+
430
+ - Provides the PHP version in semver format.
431
+
432
+ ```yaml
433
+ - name: Setup PHP
434
+ id: setup-php
435
+ uses: shivammathur/setup-php@v2
436
+ with:
437
+ php-version: '8.1'
438
+
439
+ - name: Print PHP version
440
+ run: echo ${{ steps.setup-php.outputs.php-version }}
441
+ ```
442
+
443
+ ### Flags
444
+
445
+ > Specify using `env` keyword
446
+
447
+ #### `fail-fast` (optional)
448
+
449
+ - Specify to mark the workflow as failed if an extension or tool fails to set up.
450
+ - This changes the default mode from graceful warnings to fail-fast.
451
+ - By default, it is set to `false`.
452
+ - Accepts `true` and `false`.
453
+
454
+ #### `phpts` (optional)
455
+
456
+ - Specify to set up thread-safe version of PHP on Windows.
457
+ - Accepts `ts` and `nts`.
458
+ - By default, it is set to `nts`.
459
+ - See [thread safe setup](#thread-safe-setup) for more info.
460
+
461
+ #### `update` (optional)
462
+
463
+ - Specify to update PHP on the runner to the latest patch version.
464
+ - Accepts `true` and `false`.
465
+ - By default, it is set to `false`.
466
+ - See [force update setup](#force-update-setup) for more info.
467
+
468
+ See below for more info.
469
+
470
+ ### Basic Setup
471
+
472
+ > Set up a particular PHP version.
473
+
474
+ ```yaml
475
+ steps:
476
+ - name: Setup PHP
477
+ uses: shivammathur/setup-php@v2
478
+ with:
479
+ php-version: '8.1'
480
+ extensions: mbstring, intl
481
+ ini-values: post_max_size=256M, max_execution_time=180
482
+ coverage: xdebug
483
+ tools: php-cs-fixer, phpunit
484
+ ```
485
+
486
+ ### Matrix Setup
487
+
488
+ > Set up multiple PHP versions on multiple operating systems.
489
+
490
+ ```yaml
491
+ jobs:
492
+ run:
493
+ runs-on: ${{ matrix.operating-system }}
494
+ strategy:
495
+ matrix:
496
+ operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
497
+ php-versions: ['7.4', '8.0', '8.1']
498
+ phpunit-versions: ['latest']
499
+ include:
500
+ - operating-system: 'ubuntu-latest'
501
+ php-versions: '7.2'
502
+ phpunit-versions: '8.5.21'
503
+ steps:
504
+ - name: Setup PHP
505
+ uses: shivammathur/setup-php@v2
506
+ with:
507
+ php-version: ${{ matrix.php-versions }}
508
+ extensions: mbstring, intl
509
+ ini-values: post_max_size=256M, max_execution_time=180
510
+ coverage: xdebug
511
+ tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
512
+ ```
513
+
514
+ ### Nightly Build Setup
515
+
516
+ > Set up a nightly build of `PHP 8.2`.
517
+
518
+ - This PHP version is currently in active development and might contain bugs and breaking changes.
519
+ - Some user space extensions might not support this version currently.
520
+
521
+ ```yaml
522
+ steps:
523
+ - name: Setup nightly PHP
524
+ uses: shivammathur/setup-php@v2
525
+ with:
526
+ php-version: '8.2'
527
+ extensions: mbstring
528
+ ini-values: post_max_size=256M, max_execution_time=180
529
+ coverage: xdebug
530
+ tools: php-cs-fixer, phpunit
531
+ ```
532
+
533
+ ### Thread Safe Setup
534
+
535
+ > Set up `TS` or `NTS` PHP on `Windows`.
536
+
537
+ - `NTS` versions are set up by default.
538
+ - On `Ubuntu` and `macOS` only `NTS` versions are supported.
539
+ - On `Windows` both `TS` and `NTS` versions are supported.
540
+
541
+ ```yaml
542
+ jobs:
543
+ run:
544
+ runs-on: windows-latest
545
+ name: Setup PHP TS on Windows
546
+ steps:
547
+ - name: Setup PHP
548
+ uses: shivammathur/setup-php@v2
549
+ with:
550
+ php-version: '8.1'
551
+ env:
552
+ phpts: ts # specify ts or nts
553
+ ```
554
+
555
+ ### Force Update Setup
556
+
557
+ > Update to the latest patch of PHP versions.
558
+
559
+ - Pre-installed PHP versions are not updated to their latest patch release by default.
560
+ - You can specify the `update` environment variable to `true` for updating to the latest release.
561
+
562
+ ```yaml
563
+ - name: Setup PHP with latest versions
564
+ uses: shivammathur/setup-php@v2
565
+ with:
566
+ php-version: '8.1'
567
+ env:
568
+ update: true # specify true or false
569
+ ```
570
+
571
+ ### Verbose Setup
572
+
573
+ > Debug your workflow
574
+
575
+ To debug any issues, you can use the `verbose` tag instead of `v2`.
576
+
577
+ ```yaml
578
+ - name: Setup PHP with logs
579
+ uses: shivammathur/setup-php@verbose
580
+ with:
581
+ php-version: '8.1'
582
+ ```
583
+
584
+ ### Multi-Arch Setup
585
+
586
+ > Set up PHP on multiple architecture on Ubuntu GitHub Runners.
587
+
588
+ - `PHP 5.6` to `PHP 8.1` are supported by `setup-php` on multiple architecture on `Ubuntu`.
589
+ - For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` installed for `setup-php`.
590
+ - Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup).
591
+
592
+ ```yaml
593
+ jobs:
594
+ run:
595
+ runs-on: ubuntu-latest
596
+ container: shivammathur/node:latest-${{ matrix.arch }}
597
+ strategy:
598
+ matrix:
599
+ arch: ["amd64", "i386"]
600
+ steps:
601
+ - name: Install PHP
602
+ uses: shivammathur/setup-php@v2
603
+ with:
604
+ php-version: '8.1'
605
+ ```
606
+
607
+ ### Self Hosted Setup
608
+
609
+ > Set up PHP on a self-hosted runner.
610
+
611
+ - To set up a containerised self-hosted runner, refer to the following guides as per your base operating system.
612
+ - [Linux](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Linux)
613
+ - [Windows](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows)
614
+
615
+ - To set up the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
616
+ - If your workflow uses [service containers](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices "GitHub Actions Services"), then set up the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.
617
+
618
+ It is recommended to specify the environment variable `runner` with the value `self-hosted` for self-hosted environments.
619
+
620
+ ```yaml
621
+ jobs:
622
+ run:
623
+ runs-on: self-hosted
624
+ strategy:
625
+ matrix:
626
+ php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
627
+ name: PHP ${{ matrix.php-versions }}
628
+ steps:
629
+ - name: Setup PHP
630
+ uses: shivammathur/setup-php@v2
631
+ with:
632
+ php-version: ${{ matrix.php-versions }}
633
+ env:
634
+ runner: self-hosted
635
+ ```
636
+
637
+ **Notes**
638
+ - Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
639
+ - Do not set up self-hosted runners on the side on your development environment or your production server.
640
+ - Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
641
+
642
+ ### Local Testing Setup
643
+
644
+ > Test your `Ubuntu` workflow locally using [`nektos/act`](https://github.com/nektos/act "Project to test GitHub Actions locally").
645
+
646
+ ```yaml
647
+ jobs:
648
+ run:
649
+ runs-on: ubuntu-latest
650
+ steps:
651
+ - name: Setup PHP
652
+ uses: shivammathur/setup-php@v2
653
+ with:
654
+ php-version: '8.1'
655
+ ```
656
+
657
+ Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
658
+
659
+ Choose the image tag which matches the `runs-on` property in your workflow. For example, if you are using `ubuntu-20.04` in your workflow, run `act -P ubuntu-20.04=shivammathur/node:20.04`.
660
+
661
+ ```bash
662
+ # For runs-on: ubuntu-latest
663
+ act -P ubuntu-latest=shivammathur/node:latest
664
+
665
+ # For runs-on: ubuntu-20.04
666
+ act -P ubuntu-20.04=shivammathur/node:2004
667
+
668
+ # For runs-on: ubuntu-18.04
669
+ act -P ubuntu-18.04=shivammathur/node:1804
670
+ ```
671
+
672
+ ### JIT Configuration
673
+
674
+ > Enable Just-in-time(JIT) on PHP 8.0 and above.
675
+
676
+ - To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`.
677
+ - JIT conflicts with `Xdebug`, `PCOV`, and other extensions which override `zend_execute_ex` function, so set `coverage: none` and disable any such extension if added.
678
+ - By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` are set which can be changed using `ini-values` input.
679
+ - 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").
680
+
681
+ For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
682
+
683
+ ```yaml
684
+ - name: Setup PHP with JIT in tracing mode
685
+ uses: shivammathur/setup-php@v2
686
+ with:
687
+ php-version: '8.1'
688
+ coverage: none
689
+ ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
690
+ ```
691
+
692
+ ### Cache Extensions
693
+
694
+ You can cache PHP extensions using `shivammathur/cache-extensions` and `action/cache` GitHub Actions. Extensions which take very long to set up when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
695
+ Refer to [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") for details.
696
+
697
+ ### Cache Composer Dependencies
698
+
699
+ If your project uses composer, you can persist the composer's internal cache directory. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
700
+
701
+ ```yaml
702
+ - name: Get composer cache directory
703
+ id: composer-cache
704
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
705
+
706
+ - name: Cache dependencies
707
+ uses: actions/cache@v2
708
+ with:
709
+ path: ${{ steps.composer-cache.outputs.dir }}
710
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
711
+ restore-keys: ${{ runner.os }}-composer-
712
+
713
+ - name: Install dependencies
714
+ run: composer install --prefer-dist
715
+ ```
716
+
717
+ **Notes**
718
+ - Please do not cache `vendor` directory using `action/cache` as that will have side effects.
719
+ - If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
720
+ ```yaml
721
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
722
+ ```
723
+
724
+ - If you support a range of `composer` dependencies and use `prefer-lowest` and `prefer-stable` options, you can store them in your matrix and add them to the keys.
725
+ ```yaml
726
+ key: ${{ runner.os }}-composer-${{ matrix.prefer }}-${{ hashFiles('**/composer.lock') }}
727
+ restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
728
+ ```
729
+
730
+ ### Composer GitHub OAuth
731
+
732
+ If you have a number of workflows which set up multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. Also, if you specify only the major version or the version in `major.minor` format, you can hit the rate limit. To avoid this you can specify an `OAuth` token by setting `COMPOSER_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
733
+
734
+ ```yaml
735
+ - name: Setup PHP
736
+ uses: shivammathur/setup-php@v2
737
+ with:
738
+ php-version: '8.1'
739
+ env:
740
+ COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
741
+ ```
742
+
743
+ ### Inline PHP Scripts
744
+
745
+ If you have to run multiple lines of PHP code in your workflow, you can do that easily without saving it to a file.
746
+
747
+ Put the code in the run property of a step and specify the shell as `php {0}`.
748
+
749
+ ```yaml
750
+ - name: Setup PHP
751
+ uses: shivammathur/setup-php@v2
752
+ with:
753
+ php-version: '8.1'
754
+
755
+ - name: Run PHP code
756
+ shell: php {0}
757
+ run: |
758
+ <?php
759
+ $welcome = "Hello, world";
760
+ echo $welcome;
761
+ ```
762
+
763
+ ### Problem Matchers
764
+
765
+ Problem matchers are `json` configurations which identify errors and warnings in your logs and surface them prominently in the GitHub Actions UI by highlighting them and creating code annotations.
766
+
767
+ #### PHP
768
+
769
+ Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step.
770
+
771
+ ```yaml
772
+ - name: Setup problem matchers for PHP
773
+ run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
774
+ ```
775
+
776
+ #### PHPUnit
777
+
778
+ Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step.
779
+
780
+ ```yaml
781
+ - name: Setup problem matchers for PHPUnit
782
+ run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
783
+ ```
784
+
785
+ #### PHPStan
786
+
787
+ PHPStan supports error reporting in GitHub Actions, so it does not require problem matchers.
788
+
789
+ ```yaml
790
+ - name: Setup PHP
791
+ uses: shivammathur/setup-php@v2
792
+ with:
793
+ php-version: '8.1'
794
+ tools: phpstan
795
+
796
+ - name: Run PHPStan
797
+ run: phpstan analyse src
798
+ ```
799
+
800
+ #### Psalm
801
+
802
+ Psalm supports error reporting in GitHub Actions with an output format `github`.
803
+
804
+ ```yaml
805
+ - name: Setup PHP
806
+ uses: shivammathur/setup-php@v2
807
+ with:
808
+ php-version: '8.1'
809
+ tools: psalm
810
+
811
+ - name: Run Psalm
812
+ run: psalm --output-format=github
813
+ ```
814
+
815
+ #### Tools with checkstyle support
816
+
817
+ For tools that support `checkstyle` reporting like `phpstan`, `psalm`, `php-cs-fixer` and `phpcs` you can use `cs2pr` to annotate your code.
818
+ For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
819
+
820
+ > Here is an example with `phpcs`.
821
+
822
+ ```yaml
823
+ - name: Setup PHP
824
+ uses: shivammathur/setup-php@v2
825
+ with:
826
+ php-version: '8.1'
827
+ tools: cs2pr, phpcs
828
+
829
+ - name: Run phpcs
830
+ run: phpcs -q --report=checkstyle src | cs2pr
831
+ ```
832
+
833
+ ### Examples
834
+
835
+ Examples of using `setup-php` with various PHP Frameworks and Packages.
836
+
837
+ | Framework/Package | Runs on | Workflow |
838
+ |----------------------------------------|---------------------------------|---------------------------------------------------------------------------------------------------------------|
839
+ | Blackfire | `macOS`, `ubuntu` and `windows` | [blackfire.yml](./examples/blackfire.yml "GitHub Action using Blackfire") |
840
+ | Blackfire Player | `macOS`, `ubuntu` and `windows` | [blackfire-player.yml](./examples/blackfire-player.yml "GitHub Action using Blackfire Player") |
841
+ | CakePHP with `MySQL` and `Redis` | `ubuntu` | [cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis") |
842
+ | CakePHP with `PostgreSQL` and `Redis` | `ubuntu` | [cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis") |
843
+ | CakePHP without services | `macOS`, `ubuntu` and `windows` | [cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services") |
844
+ | CodeIgniter | `macOS`, `ubuntu` and `windows` | [codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter") |
845
+ | Laminas MVC | `macOS`, `ubuntu` and `windows` | [laminas-mvc.yml](./examples/laminas-mvc.yml "GitHub Action for Laminas Framework MVC Projects") |
846
+ | Laravel with `MySQL` and `Redis` | `ubuntu` | [laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis") |
847
+ | Laravel with `PostgreSQL` and `Redis` | `ubuntu` | [laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis") |
848
+ | Laravel without services | `macOS`, `ubuntu` and `windows` | [laravel.yml](./examples/laravel.yml "GitHub Action for Laravel without services") |
849
+ | Lumen with `MySQL` and `Redis` | `ubuntu` | [lumen-mysql.yml](./examples/lumen-mysql.yml "GitHub Action for Lumen with MySQL and Redis") |
850
+ | Lumen with `PostgreSQL` and `Redis` | `ubuntu` | [lumen-postgres.yml](./examples/lumen-postgres.yml "GitHub Action for Lumen with PostgreSQL and Redis") |
851
+ | Lumen without services | `macOS`, `ubuntu` and `windows` | [lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services") |
852
+ | Phalcon with `MySQL` | `ubuntu` | [phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL") |
853
+ | Phalcon with `PostgreSQL` | `ubuntu` | [phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL") |
854
+ | Roots/bedrock | `ubuntu` | [bedrock.yml](./examples/bedrock.yml "GitHub Action for Wordpress Development using @roots/bedrock") |
855
+ | Roots/sage | `ubuntu` | [sage.yml](./examples/sage.yml "GitHub Action for Wordpress Development using @roots/sage") |
856
+ | Slim Framework | `macOS`, `ubuntu` and `windows` | [slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework") |
857
+ | Symfony with `MySQL` | `ubuntu` | [symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL") |
858
+ | Symfony with `PostgreSQL` | `ubuntu` | [symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL") |
859
+ | Symfony without services | `macOS`, `ubuntu` and `windows` | [symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services") |
860
+ | Yii2 Starter Kit with `MySQL` | `ubuntu` | [yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL") |
861
+ | Yii2 Starter Kit with `PostgreSQL` | `ubuntu` | [yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL") |
862
+
863
+ ## :bookmark: Versioning
864
+
865
+ - 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.
866
+ - 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.
867
+ - 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.
868
+ - For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
869
+ - It is highly discouraged to use the `master` branch as version, it might break your workflow after major releases as they have breaking changes.
870
+ - 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.
871
+
872
+ ## :scroll: License
873
+
874
+ - The scripts and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/setup-php").
875
+ - This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
876
+ - 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").
877
+
878
+ ## :+1: Contributions
879
+
880
+ > Contributions are welcome!
881
+
882
+ - See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide") before you start.
883
+ - If you face any issues or want to suggest a feature/improvement, start a discussion [here](https://github.com/shivammathur/setup-php/discussions "Setup PHP discussions").
884
+
885
+ *Contributors of `setup-php` and other related projects*
886
+
887
+ <p align="center">
888
+ <a href="https://github.com/shivammathur/setup-php/graphs/contributors">
889
+ <img src="https://setup-php.com/contributors/?" alt="Contributors of setup-php and related projects" width="100%">
890
+ </a>
891
+ </p>
892
+
893
+ ## :sparkling_heart: Support This Project
894
+
895
+ - Please star the project and share it. If you blog, please share your experience of using `setup-php`.
896
+ - Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
897
+
898
+ Many users and organisations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
899
+
900
+ <a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
901
+
902
+ These companies generously provide setup-php their products and services to aid in the development of this project.
903
+
904
+ <p>
905
+ <a href="https://www.jetbrains.com/?from=setup-php">
906
+ <img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
907
+ </a>
908
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
909
+ <a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
910
+ <img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="148" height="60">
911
+ </a>
912
+ <a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
913
+ <img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="148" height="60">
914
+ </a>
915
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
916
+ <a href="https://tidelift.com/subscription/pkg/npm-setup-php">
917
+ <img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="70" height="60">
918
+ </a>
919
+ </p>
920
+
921
+ ## :package: Dependencies
922
+
923
+ - [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
924
+ - [aaronparker/VcRedist](https://github.com/aaronparker/VcRedist "VcRedist PowerShell package")
925
+ - [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
926
+ - [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
927
+ - [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions")
928
+ - [shivammathur/composer-cache](https://github.com/shivammathur/composer-cache "Cache composer releases")
929
+ - [shivammathur/homebrew-extensions](https://github.com/shivammathur/homebrew-extensions "Tap for PHP extensions on MacOS")
930
+ - [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds on MacOS")
931
+ - [shivammathur/icu-intl](https://github.com/shivammathur/icu-intl "icu4c and php-intl builds")
932
+ - [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package for Ubuntu")
933
+ - [shivammathur/php-builder-windows](https://github.com/shivammathur/php-builder-windows "Nightly PHP package for Windows")
934
+ - [shivammathur/php-ubuntu](https://github.com/shivammathur/php-ubuntu "Cache stable PHP Packages for Ubuntu")
935
+ - [shivammathur/php5-darwin](https://github.com/shivammathur/php5-darwin "Scripts to set up PHP5 versions on darwin")
936
+ - [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to set up PHP5 versions on ubuntu")
937
+
938
+ ## :bookmark_tabs: Further Reading
939
+
940
+ - [About GitHub Actions](https://github.com/features/actions "GitHub Actions")
941
+ - [GitHub Actions Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions "GitHub Actions Syntax")
942
+ - [Other Awesome Actions](https://github.com/sdras/awesome-actions "List of Awesome GitHub Actions")
943
+
944
+
945
+ <!-- Links to tools -->
946
+ [`behat`]: https://docs.behat.org/en/latest/
947
+ [`blackfire`]: https://blackfire.io/docs/php/index
948
+ [`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
949
+ [`churn`]: https://github.com/bmitch/churn-php
950
+ [`codeception`]: https://codeception.com/
951
+ [`composer`]: https://getcomposer.org/
952
+ [`composer-normalize`]: https://github.com/ergebnis/composer-normalize
953
+ [`composer-prefetcher`]: https://github.com/narrowspark/automatic-composer-prefetcher
954
+ [`composer-require-checker`]: https://github.com/maglnet/ComposerRequireChecker
955
+ [`composer-unused`]: https://github.com/composer-unused/composer-unused
956
+ [`cs2pr`]: https://github.com/staabm/annotate-pull-request-from-checkstyle
957
+ [`deployer`]: https://deployer.org/
958
+ [`flex`]: https://flex.symfony.com/
959
+ [`grpc_php_plugin`]: https://grpc.io/
960
+ [`infection`]: https://infection.github.io/
961
+ [`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
962
+ [`pecl`]: https://pecl.php.net/
963
+ [`phan`]: https://github.com/phan/phan/wiki
964
+ [`phing`]: https://www.phing.info/
965
+ [`phinx`]: https://phinx.org/
966
+ [`phive`]: https://phar.io/
967
+ [`php-config`]: https://www.php.net/manual/en/install.pecl.php-config.php
968
+ [`php-cs-fixer`]: https://cs.symfony.com/
969
+ [`phpcbf`]: https://github.com/squizlabs/php_codesniffer
970
+ [`phpcpd`]: https://github.com/sebastianbergmann/phpcpd
971
+ [`phpcs`]: https://github.com/squizlabs/php_codesniffer
972
+ [`phpdoc`]: https://phpdoc.org/
973
+ [`phpDocumentor`]: https://phpdoc.org/
974
+ [`phpize`]: https://www.php.net/manual/en/install.pecl.phpize.php
975
+ [`phplint`]: https://github.com/overtrue/phplint
976
+ [`phpmd`]: https://phpmd.org/
977
+ [`phpspec`]: https://www.phpspec.net/
978
+ [`phpstan`]: https://phpstan.org/
979
+ [`phpunit`]: https://phpunit.de/
980
+ [`phpunit-bridge`]: https://symfony.com/doc/current/components/phpunit_bridge.html
981
+ [`phpunit-polyfills`]: https://github.com/Yoast/PHPUnit-Polyfills
982
+ [`prestissimo`]: https://github.com/hirak/prestissimo
983
+ [`protoc`]: https://developers.google.com/protocol-buffers/
984
+ [`psalm`]: https://psalm.dev/
985
+ [`symfony`]: https://symfony.com/download
986
+ [`symfony-cli`]: https://symfony.com/download
987
+ [`vapor`]: https://docs.vapor.build/
988
+ [`vapor-cli`]: https://docs.vapor.build/
989
+ [`wp`]: https://wp-cli.org/
990
+ [`wp-cli`]: https://wp-cli.org/