{"id":15021428,"url":"https://github.com/php/php-windows-builder","last_synced_at":"2026-01-12T13:41:17.916Z","repository":{"id":219852789,"uuid":"749867047","full_name":"php/php-windows-builder","owner":"php","description":"Tooling to build PHP and extensions on Windows","archived":false,"fork":false,"pushed_at":"2026-01-10T06:08:43.000Z","size":582,"stargazers_count":61,"open_issues_count":0,"forks_count":37,"subscribers_count":13,"default_branch":"master","last_synced_at":"2026-01-11T01:44:23.307Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-29T14:58:39.000Z","updated_at":"2026-01-10T05:58:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"af5d39c9-04dc-4bed-990d-9226728c0312","html_url":"https://github.com/php/php-windows-builder","commit_stats":{"total_commits":154,"total_committers":3,"mean_commits":"51.333333333333336","dds":"0.012987012987012991","last_synced_commit":"09aeda8754e1cc6ab7690bc19e0ae0fc47d19600"},"previous_names":["php/php-windows-builder"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/php/php-windows-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fphp-windows-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fphp-windows-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fphp-windows-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fphp-windows-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php","download_url":"https://codeload.github.com/php/php-windows-builder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fphp-windows-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28339319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:56:34.062Z","updated_at":"2026-01-12T13:41:17.825Z","avatar_url":"https://github.com/php.png","language":"PowerShell","readme":"# php-windows-builder\n\nThis project provides PowerShell packages and GitHub Actions to build PHP and its extensions on Windows.\n\n## Index\n\n- [GitHub Actions](#github-actions)\n    - [Build PHP](#build-php)\n        - [Inputs](#inputs)\n        - [Example workflow to build PHP](#example-workflow-to-build-php)\n    - [Build a PHP extension](#build-a-php-extension)\n        - [Inputs](#inputs-1)\n    - [Get the job matrix to build a PHP extension](#get-the-job-matrix-to-build-a-php-extension)\n        - [Inputs](#inputs-2)\n        - [Outputs](#outputs)\n        - [PHP Version Support](#php-version-support)\n    - [Release](#release)\n        - [Inputs](#inputs-3)\n        - [Example workflow for non-immutable releases](#example-workflow-for-non-immutable-releases)\n        - [Example workflow for immutable releases](#example-workflow-for-immutable-releases)\n\n- [Local Setup](#local-setup)\n    - [PHP](#php)\n    - [PHP Extensions](#php-extensions)\n\n- [License](#license)\n\n## GitHub Actions\n\n### Build PHP\n\nBuild a specific version of PHP, with the required architecture and thread safety.\n\n```yaml\n- name: Build PHP\n  uses: php/php-windows-builder/php@v1\n  with:\n    php-version: '8.4.11'\n    arch: x64\n    ts: nts\n```\n\n#### Inputs\n\n- `php-version` (required): The PHP version to build. It supports values in major.minor.patch format, e.g., 7.4.25, 8.0.12, etc., or `master` for the master branch of `php-src`.\n- `arch` (required): The architecture to build. It supports values `x64` and `x86`.\n- `ts` (required): The thread safety to build. It supports values `ts` and `nts`.\n\n#### Example workflow to build PHP\n\n```yaml\njobs:\n  php:\n    strategy:\n      matrix:\n        arch: [x64, x86]\n        ts: [nts, ts]\n    runs-on: windows-2022\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n\n      - name: Build\n        uses: php/php-windows-builder/php@v1\n        with:\n          php-version: '8.4.11'\n          arch: ${{ matrix.arch }}\n          ts: ${{ matrix.ts }}\n```\n\nThe above workflow will produce the following builds for the PHP version `8.4.11` as artifacts.\n\n- nts-x64, nts-x64-AVX, ts-x64, nts-x86, ts-x86.\n- debug-pack and devel-pack for each of the above configurations.\n- test pack\n\n### Build a PHP extension\n\nBuild a specific version of a PHP extension.\n\n```yaml\n- name: Build the extension\n  uses: php/php-windows-builder/extension@v1\n  with:\n    extension-url: https://github.com/xdebug/xdebug\n    extension-ref: '3.4.5'\n    php-version: '8.3'\n    ts: nts\n    arch: x64\n    args: --with-xdebug\n    libs: zlib\n```\n\n#### Inputs\n\n- `extension-url` (optional): URL of the extension's git repository, defaults to the current repository.\n- `extension-ref` (optional): The git reference to build the extension, defaults to the GitHub reference that triggered the workflow.\n- `php-version` (required): The PHP versions to build the extension for.\n- `arch` (required): The architecture to build the extension for.\n- `ts` (required): The thread safety to build the extension for.\n- `args` (optional): Additional arguments to pass to the `configure` script.\n- `libs` (optional): Libraries required for the extension.\n- `build-directory` (optional): The directory to build the extension in, defaults to the user's temporary directory.\n- `run-tests` (optional): Run the extension tests. Defaults to `true`.\n- `test-runner` (optional): The test runner to use. Defaults to `run-tests.php`.\n- `test-runner-args` (optional): Arguments to pass to the test runner.\n- `test-opcache-mode` (optional): Run tests with opcache `on`, `off` or `both`. Defaults to `off`.\n- `test-workers` (optional): The number of workers to use when running tests. Defaults to `8`.\n- `auth-token` (optional): Authentication token to use in case the extension is hosted on a private repository.\n\nInstead of having to configure all the inputs for the extension action, you can use the `extension-matrix` action to get the matrix of jobs with different input configurations.\n\n### Get the job matrix to build a PHP extension\n\n```yaml\njobs:\n  get-extension-matrix:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n      - name: Get the extension matrix\n        id: extension-matrix\n        uses: php/php-windows-builder/extension-matrix@v1\n        with:\n          extension-url: https://github.com/xdebug/xdebug\n          extension-ref: '3.4.5'\n          php-version-list: '8.2, 8.3'\n          arch-list: 'x64, x86'\n          ts-list: 'nts, ts'\n```\n\n#### Inputs\n\n- `extension-url` (optional): URL of the extension's git repository, defaults to the current repository.\n- `extension-ref` (optional): The git reference to build the extension, defaults to the GitHub reference that triggered the workflow.\n- `php-version-list` (optional): The PHP versions to build the extension for. Defaults to the PHP versions required in the `composer.json` file.\n- `arch-list` (optional): The architectures to build the extension for. Defaults to `x64, x86`.\n- `ts-list` (optional): The thread safety to build the extension for. Defaults to `nts, ts`.\n- `allow-old-php-versions` (optional): Allow building the extension for older PHP versions. Defaults to `false`.\n- `auth-token` (optional): Authentication token to use in case the extension is hosted on a private repository.\n\n#### Outputs\n\n- `matrix` - The matrix of jobs with different input configurations.\n\n#### PHP Version Support\n\nBy default, the `extension-matrix` action will use the PHP versions defined in the `php-version-list` input.\n\nIf the `php-version-list` input is not provided, it will use the PHP versions required in the `composer.json` file.\n\nIt will also check if a GitHub hosted Windows runner is available with the required Visual Studio version to build the extension for the PHP version or try to install it. To override this for building the extension for older PHP versions, you will have to set the input `allow-old-php-versions` to `true` and add self-hosted Windows runners as specified in the table below.\n\n| PHP Version | Visual Studio Version | Windows Runner Labels       |\n|-------------|-----------------------|-----------------------------|\n| 7.0         | 2015 (vc14)           | windows-2012, self-hosted   |\n| 7.1         | 2015 (vc14)           | windows-2012, self-hosted   |\n| 7.2         | 2017 (vc15)           | windows-2022, github-hosted |\n| 7.3         | 2017 (vc15)           | windows-2022, github-hosted |\n| 7.4         | 2017 (vc15)           | windows-2022, github-hosted |\n| 8.0         | 2019 (vs16)           | windows-2022, github-hosted |\n| 8.1         | 2019 (vs16)           | windows-2022, github-hosted |\n| 8.2         | 2019 (vs16)           | windows-2022, github-hosted |\n| 8.3         | 2019 (vs16)           | windows-2022, github-hosted |\n| 8.4         | 2022 (vs17)           | windows-2022, github-hosted |\n| 8.5         | 2022 (vs17)           | windows-2022, github-hosted |\n| master      | 2022 (vs17)           | windows-2022, github-hosted |\n\n### Release\n\nUpload the artifacts to a release.\n\n```yaml\n- name: Upload artifact to the release\n  uses: php/php-windows-builder/release@v1\n  with:\n    release: ${{ github.event.release.tag_name }}\n    token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n#### Inputs\n\n- `release` (required): The release/tag to upload the artifacts.\n- `token` (optional): The GitHub token to authenticate with. Defaults to `GITHUB_TOKEN` secret.\n- `draft` (optional): Whether to create a draft release if the release does not exist. Defaults to `false`.\n\n#### Example workflow for non-immutable releases\n\nFollow this if you are creating the release, and they are not immutable (This is the default).\n\nFor non-immutable releases, you can publish them, and the workflow will upload the extension builds to the release.\n\n```yaml\nname: Build extension\non:\n  # When a new release is created, we can build, and upload the DLLs to it.\n  release:\n    types: [created]\n  # push: # Uncomment this to run on push to a branch\n  # create: # Uncomment this to run on tag/branch creation\n  # pull_request: # Uncomment this to run on pull requests  \n\npermissions:\n  contents: write\n\njobs:\n  # This job generates a matrix of PHP versions, architectures, and thread safety options\n  # This is done by reading the constraints from composer.json or the package.xml file.\n  # Please refer to https://github.com/php/php-windows-builder#get-the-job-matrix-to-build-a-php-extension\n  get-extension-matrix:\n    runs-on: ubuntu-latest\n    outputs:\n      matrix: ${{ steps.extension-matrix.outputs.matrix }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n\n      - name: Get the extension matrix\n        id: extension-matrix\n        uses: php/php-windows-builder/extension-matrix@v1\n\n  # This job builds the extension on Windows using the matrix generated from the previous job.      \n  build:\n    needs: get-extension-matrix\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n\n      - name: Build the extension\n        uses: php/php-windows-builder/extension@v1\n        with:\n          # Always specify the php-version, arch, and ts as they are required inputs.\n          # Please refer to https://github.com/php/php-windows-builder#build-a-php-extension\n          php-version: ${{ matrix.php-version }}\n          arch: ${{ matrix.arch }}\n          ts: ${{ matrix.ts }}\n          \n  # This job uploads the built artifacts to the GitHub release.\n  release:\n    runs-on: ubuntu-latest\n    needs: build\n    if: ${{ github.event_name == 'release' }}\n    steps:\n      - name: Upload artifact to the release\n        uses: php/php-windows-builder/release@v1\n        with:\n          release: ${{ github.event.release.tag_name }}\n          token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n#### Example workflow for immutable releases\n\nFollow this if you are using immutable releases.\n\nFor immutable releases, please do not create a new release using the GitHub UI, you can push a new tag, and the workflow will create a new release, build the extension, and upload the builds to the release.\n\nIt publishes the release by default, and then you can edit the release notes as needed, If you want to create a draft release, set the `draft` input to `true` in the `release` job.\n\n```yaml\nname: Build extension\non:\n  # When a new tag is pushed, we can build, and upload the DLLs to it.\n  push:\n    # branches: ['**'] # Uncomment this to run on push to a branch\n    tags: ['*']\n  # create: # Uncomment this to run on tag/branch creation\n  # pull_request: # Uncomment this to run on pull requests  \n\npermissions:\n  contents: write\n\njobs:\n  # This job generates a matrix of PHP versions, architectures, and thread safety options\n  # This is done by reading the constraints from composer.json or the package.xml file.\n  # Please refer to https://github.com/php/php-windows-builder#get-the-job-matrix-to-build-a-php-extension\n  get-extension-matrix:\n    runs-on: ubuntu-latest\n    outputs:\n      matrix: ${{ steps.extension-matrix.outputs.matrix }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n\n      - name: Get the extension matrix\n        id: extension-matrix\n        uses: php/php-windows-builder/extension-matrix@v1\n\n  # This job builds the extension on Windows using the matrix generated from the previous job.      \n  build:\n    needs: get-extension-matrix\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n\n      - name: Build the extension\n        uses: php/php-windows-builder/extension@v1\n        with:\n          # Always specify the php-version, arch, and ts as they are required inputs.\n          # Please refer to https://github.com/php/php-windows-builder#build-a-php-extension\n          php-version: ${{ matrix.php-version }}\n          arch: ${{ matrix.arch }}\n          ts: ${{ matrix.ts }}\n          \n  # This job uploads the build artifacts to the immutable GitHub release it creates.\n  release:\n    runs-on: ubuntu-latest\n    needs: build\n    if: ${{ github.event_name == 'push' \u0026\u0026 startsWith(github.ref, 'refs/tags/') }}\n    steps:\n      - name: Upload artifact to the release\n        uses: php/php-windows-builder/release@v1\n        with:\n          release: ${{ github.ref }}\n          token: ${{ secrets.GITHUB_TOKEN }}\n          # Uncomment the line below to create a draft release\n          # draft: 'true' \n```\n\nFor more example workflows, please refer to the [examples](./examples) directory.\n\n## Local Setup\n\n### PHP\n\nTo build PHP locally, you can install the `BuildPhp` powershell module from the PowerShell Gallery:\n\nYou'll need at least PowerShell version 5, which is available by default on Windows 10 and later. It is recommended to use PowerShell 7 or later.\nIf you have an older version, you can install the latest version [following these instructions](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows).\n\nOpen an elevated PowerShell session (Run as Administrator) and run the following command to install the module:\n\n```powershell\nInstall-Module -Name BuildPhp -Repository PSGallery -Force\n```\n\nTo install this module for the current user only:\n\n```powershell\nInstall-Module -Name BuildPhp -Repository PSGallery -Force -Scope CurrentUser\n```\n\nNext, make sure you have the required Visual Studio version installed to build the PHP version you want. You can find the required Visual Studio version in the [PHP Version Support table](#php-version-support) above.\nIf the required Visual Studio version is not installed, for the first time you try to build PHP, the module will try to install the required Visual Studio components automatically.\n\nThen, you can build PHP by using the `Invoke-PhpBuild` command.\n- To build a specific PHP version, you can use the `PhpVersion` input. It supports values in major.minor.patch format, e.g., 7.4.25, 8.0.12, etc., or `master` for the master branch of `php-src`.\n- To build a 32-bit or a 64-bit version, you can use the `Arch` input. It supports values `x64` and `x86`.\n- To build a thread-safe or non-thread-safe version, you can use the `Ts` input. It supports values `ts` and `nts`.\n\n```powershell\nInvoke-PhpBuild -PhpVersion '8.4.11' -Arch x64 -Ts nts\n```\n\nTo build PHP from a local source, run `Invoke-PhpBuild` from the source directory and omit the `PhpVersion` input.\n\n```powershell\nInvoke-PhpBuild -Arch x64 -Ts nts\n```\n\nIt should produce the PGO optimized builds for the input PHP version and configuration in a directory named `artifacts` in the current directory.\n\n### PHP Extensions\n\nTo build a PHP extension locally, you can install the `BuildPhpExtension` powershell module from the PowerShell Gallery:\nAgain, You'll need at least PowerShell version 5, which is available by default on Windows 10 and later. It is recommended to use PowerShell 7 or later.\nIf you have an older version, you can install the latest version [following these instructions](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows).\n\nOpen an elevated PowerShell session (Run as Administrator) and run the following command to install the module:\n\n```powershell\nInstall-Module -Name BuildPhpExtension -Repository PSGallery -Force\n```\n\nTo install this module for the current user only:\n\n```powershell\nInstall-Module -Name BuildPhpExtension -Repository PSGallery -Force -Scope CurrentUser\n```\n\nNext, make sure you have the required Visual Studio version installed to build the PHP extension you want. You can find the required Visual Studio version in the [PHP Version Support table](#php-version-support) above based on the PHP version you are building the PHP extension for.\nIf the required Visual Studio version is not installed, for the first time you try to build the PHP extension, the module will try to install the required Visual Studio components automatically.\n\nThen, you can build the PHP extension by using the `Invoke-PhpBuildExtension` command.\n- To build a php extension from a git repository, you can use the `ExtensionUrl` input. It supports a git repository URL as value.\n- To build a specific version of the extension, you can use the `ExtensionRef` input. It supports a git reference, e.g., a tag or a branch as value.\n- To build the extension for a specific PHP version, you can use the `PhpVersion` input. It supports values in the `major.minor` format, e.g., 7.4, 8.0, etc.\n- To build the extension for a 32-bit or a 64-bit PHP version, you can use the `Arch` input. It supports values `x64` and `x86`.\n- To build the extension for a thread-safe or non-thread-safe PHP version, you can use the `Ts` input. It supports values `ts` and `nts`.\n- To specify the libraries required for the extension, you can use the `Libraries` input. It supports a comma-separated list of library names.\n- To specify additional arguments to pass to the `configure` script, you can use the `Args` input. It supports a string value.\n\n```powershell\nInvoke-PhpBuildExtension -ExtensionUrl https://github.com/xdebug/xdebug `\n                         -ExtensionRef 3.4.5 `\n                         -PhpVersion 8.4 `\n                         -Arch x64 `\n                         -Ts nts `\n                         -Libraries \"zlib\" `\n                         -Args \"--with-xdebug\"\n```\n\nTo build an extension from a local source, run `Invoke-PhpBuildExtension` from the extension’s source directory and omit the `ExtensionUrl` and `ExtensionRef` inputs.\n\n```powershell\n# cd to xdebug source directory, and then run\nInvoke-PhpBuildExtension -PhpVersion 8.4 -Arch x64 -Ts nts -Libraries \"zlib\" -Args \"--with-xdebug\"\n```\n\nIt should produce the extension builds in a directory named `artifacts` in the current directory.\n\n## License\n\nThe scripts and documentation in this project are released under the [MIT License](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fphp-windows-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp%2Fphp-windows-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fphp-windows-builder/lists"}