mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-11-04 08:56:36 +07:00 
			
		
		
		
	Compare commits
	
		
			33 Commits
		
	
	
		
			more-verbo
			...
			develop
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 53bf167847 | |||
| 355aade280 | |||
| 74d4e20179 | |||
| ae0a50642d | |||
| 5187d97121 | |||
| eddb855af9 | |||
| eec99716ef | |||
| 788275d42c | |||
| be38e7a127 | |||
| 47ac2e221b | |||
| 36338985e2 | |||
| 185b391822 | |||
| f210bb3904 | |||
| 6f153798c8 | |||
| f7b7badb27 | |||
| 8473b2327f | |||
| 3efd894d72 | |||
| 1e8cc75dad | |||
| 2e18086d64 | |||
| 9cf252c302 | |||
| aa0de4323f | |||
| 00242b5fc2 | |||
| 319ac00da8 | |||
| 38e8065d61 | |||
| 91a018aa46 | |||
| bdaf698d5d | |||
| ab68d9f583 | |||
| d65cf8f3f2 | |||
| 6beaa7dc34 | |||
| 79ab6fe269 | |||
| 4cbbb6d82c | |||
| 4cba65b8c5 | |||
| 7fea117d1c | 
							
								
								
									
										11
									
								
								.github/SECURITY.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/SECURITY.md
									
									
									
									
										vendored
									
									
								
							@ -2,23 +2,20 @@
 | 
			
		||||
 | 
			
		||||
## Supported Versions
 | 
			
		||||
 | 
			
		||||
The latest patch versions of `v1` and `v2` releases of this project are supported for security updates.
 | 
			
		||||
The latest patch version of `v2` release of this project is supported for security updates.
 | 
			
		||||
 | 
			
		||||
## Supported PHP Versions
 | 
			
		||||
 | 
			
		||||
This security policy only applies to the latest patches of the following PHP versions.
 | 
			
		||||
This security policy only applies to the latest patch releases of the following PHP versions.
 | 
			
		||||
 | 
			
		||||
| Version | Supported          |
 | 
			
		||||
|---------|--------------------|
 | 
			
		||||
| 8.1     | :white_check_mark: |
 | 
			
		||||
| 8.2     | :white_check_mark: |
 | 
			
		||||
| 8.3     | :white_check_mark: |
 | 
			
		||||
| 8.4     | :white_check_mark: |
 | 
			
		||||
 | 
			
		||||
## Reporting a Vulnerability
 | 
			
		||||
 | 
			
		||||
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@shivammathur.com](mailto:contact@shivammathur.com).
 | 
			
		||||
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@setup-php.com](mailto:contact@setup-php.com).
 | 
			
		||||
Do not report security reports publicly.
 | 
			
		||||
 | 
			
		||||
## Tidelift
 | 
			
		||||
 | 
			
		||||
If you use this GitHub Action through a Tidelift subscription, please refer to [https://tidelift.com/security](https://tidelift.com/security).
 | 
			
		||||
							
								
								
									
										6
									
								
								.github/workflows/codeql.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/codeql.yml
									
									
									
									
										vendored
									
									
								
							@ -21,13 +21,13 @@ jobs:
 | 
			
		||||
          fetch-depth: 2
 | 
			
		||||
 | 
			
		||||
      - name: Initialize CodeQL
 | 
			
		||||
        uses: github/codeql-action/init@v3
 | 
			
		||||
        uses: github/codeql-action/init@v4
 | 
			
		||||
        with:
 | 
			
		||||
          config-file: ./.github/codeql/codeql-configuration.yml
 | 
			
		||||
          languages: javascript
 | 
			
		||||
 | 
			
		||||
      - name: Autobuild
 | 
			
		||||
        uses: github/codeql-action/autobuild@v3
 | 
			
		||||
        uses: github/codeql-action/autobuild@v4
 | 
			
		||||
 | 
			
		||||
      - name: Perform CodeQL Analysis
 | 
			
		||||
        uses: github/codeql-action/analyze@v3
 | 
			
		||||
        uses: github/codeql-action/analyze@v4
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								.github/workflows/docs.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								.github/workflows/docs.yml
									
									
									
									
										vendored
									
									
								
							@ -16,8 +16,8 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-13]
 | 
			
		||||
        php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
 | 
			
		||||
        operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-15-intel]
 | 
			
		||||
        php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
        uses: shivammathur/setup-php@v2
 | 
			
		||||
@ -88,7 +88,7 @@ jobs:
 | 
			
		||||
          Remove-Item "$env:file.all" -Force
 | 
			
		||||
          Remove-Item "$env:file.builtin" -Force
 | 
			
		||||
      - name: Upload artifacts
 | 
			
		||||
        uses: actions/upload-artifact@v4
 | 
			
		||||
        uses: actions/upload-artifact@v5
 | 
			
		||||
        with:
 | 
			
		||||
          name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
 | 
			
		||||
          path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
 | 
			
		||||
@ -105,7 +105,7 @@ jobs:
 | 
			
		||||
        with:
 | 
			
		||||
          repository: ${{ github.repository }}.wiki
 | 
			
		||||
      - name: Download artifacts
 | 
			
		||||
        uses: actions/download-artifact@v5
 | 
			
		||||
        uses: actions/download-artifact@v6
 | 
			
		||||
        with:
 | 
			
		||||
          path: ${{ github.workspace }}/lists
 | 
			
		||||
          pattern: lists-*
 | 
			
		||||
@ -116,11 +116,11 @@ jobs:
 | 
			
		||||
          git config --local user.name "${{ github.repository_owner }}"
 | 
			
		||||
      - name: Combine
 | 
			
		||||
        run: |
 | 
			
		||||
          for os in ubuntu-24.04 ubuntu-22.04 windows-2022 windows-2019 macos-13 macos-14 macos-15; do
 | 
			
		||||
          for os in ubuntu-24.04 ubuntu-22.04 windows-2025 windows-2022 windows-2019 macos-13 macos-14 macos-15 macos-26; do
 | 
			
		||||
            echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
 | 
			
		||||
            for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5; do
 | 
			
		||||
            for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 8.6; do
 | 
			
		||||
              if [[ "${os%-*}" = "macos" ]]; then
 | 
			
		||||
                cat lists/php"$version"-macos-13.md >> Php-extensions-loaded-on-"$os".md
 | 
			
		||||
                cat lists/php"$version"-macos-15-intel.md >> Php-extensions-loaded-on-"$os".md
 | 
			
		||||
              elif [ "${os%-*}" = "windows" ]; then
 | 
			
		||||
                cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
 | 
			
		||||
              else
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/node.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/node.yml
									
									
									
									
										vendored
									
									
								
							@ -34,7 +34,7 @@ jobs:
 | 
			
		||||
          fetch-depth: 2
 | 
			
		||||
 | 
			
		||||
      - name: Setup Node.js 20.x
 | 
			
		||||
        uses: actions/setup-node@v5
 | 
			
		||||
        uses: actions/setup-node@v6
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 20.x
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								.github/workflows/php.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/php.yml
									
									
									
									
										vendored
									
									
								
							@ -28,8 +28,8 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-13]
 | 
			
		||||
        php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
 | 
			
		||||
        operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-15-intel]
 | 
			
		||||
        php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
 | 
			
		||||
        include:
 | 
			
		||||
          - operating-system: ubuntu-24.04
 | 
			
		||||
            php-versions: ''
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
								
							@ -28,7 +28,7 @@ jobs:
 | 
			
		||||
          ref: ${{ github.event.inputs.tag }}
 | 
			
		||||
 | 
			
		||||
      - name: Setup Node.js
 | 
			
		||||
        uses: actions/setup-node@v5
 | 
			
		||||
        uses: actions/setup-node@v6
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '20.x'
 | 
			
		||||
          registry-url: https://registry.npmjs.org
 | 
			
		||||
@ -46,7 +46,7 @@ jobs:
 | 
			
		||||
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
 | 
			
		||||
 | 
			
		||||
      - name: Change to GitHub Packages registry
 | 
			
		||||
        uses: actions/setup-node@v5
 | 
			
		||||
        uses: actions/setup-node@v6
 | 
			
		||||
        with:
 | 
			
		||||
          registry-url: https://npm.pkg.github.com
 | 
			
		||||
          scope: '@shivammathur'
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										75
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										75
									
								
								README.md
									
									
									
									
									
								
							@ -10,7 +10,7 @@
 | 
			
		||||
  <a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
 | 
			
		||||
  <a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></a>
 | 
			
		||||
  <a href="https://github.com/shivammathur/setup-php/blob/main/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
 | 
			
		||||
  <a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.5-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
 | 
			
		||||
  <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.6-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
 | 
			
		||||
</p>
 | 
			
		||||
<p align="center">
 | 
			
		||||
  <a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a>
 | 
			
		||||
@ -68,19 +68,20 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
 | 
			
		||||
 | 
			
		||||
### GitHub-Hosted Runners
 | 
			
		||||
 | 
			
		||||
| Virtual environment | Arch    | YAML workflow label                | Pre-installed PHP      |
 | 
			
		||||
|---------------------|---------|------------------------------------|------------------------|
 | 
			
		||||
| Ubuntu 24.04        | x86_64  | `ubuntu-latest` or `ubuntu-24.04`  | `PHP 8.3`              |
 | 
			
		||||
| Ubuntu 22.04        | x86_64  | `ubuntu-22.04`                     | `PHP 8.1`              |
 | 
			
		||||
| Ubuntu 24.04        | aarch64 | `ubuntu-24.04-arm`                 | `PHP 8.3`              |
 | 
			
		||||
| Ubuntu 22.04        | aarch64 | `ubuntu-22.04-arm`                 | `PHP 8.1`              |
 | 
			
		||||
| Windows Server 2025 | x64     | `windows-2025`                     | `PHP 8.3`              |
 | 
			
		||||
| Windows Server 2022 | x64     | `windows-latest` or `windows-2022` | `PHP 8.3`              |
 | 
			
		||||
| Windows Server 2019 | x64     | `windows-2019`                     | `PHP 8.3`              |
 | 
			
		||||
| macOS Tahoe 26.x    | arm64   | `macos-26`                         | -                      |
 | 
			
		||||
| macOS Sequoia 15.x  | arm64   | `macos-latest` or `macos-15`       | -                      |
 | 
			
		||||
| macOS Sonoma 14.x   | arm64   | `macos-14`                         | -                      |
 | 
			
		||||
| macOS Ventura 13.x  | x86_64  | `macos-13`                         | `PHP 8.3`              |
 | 
			
		||||
| Virtual environment | Arch    | YAML workflow label                | Pre-installed PHP |
 | 
			
		||||
|---------------------|---------|------------------------------------|-------------------|
 | 
			
		||||
| Ubuntu 24.04        | x86_64  | `ubuntu-latest` or `ubuntu-24.04`  | `PHP 8.3`         |
 | 
			
		||||
| Ubuntu 22.04        | x86_64  | `ubuntu-22.04`                     | `PHP 8.1`         |
 | 
			
		||||
| Ubuntu 24.04        | aarch64 | `ubuntu-24.04-arm`                 | `PHP 8.3`         |
 | 
			
		||||
| Ubuntu 22.04        | aarch64 | `ubuntu-22.04-arm`                 | `PHP 8.1`         |
 | 
			
		||||
| Windows Server 2025 | x64     | `windows-2025`                     | `PHP 8.3`         |
 | 
			
		||||
| Windows Server 2022 | x64     | `windows-latest` or `windows-2022` | `PHP 8.3`         |
 | 
			
		||||
| Windows Server 2019 | x64     | `windows-2019`                     | `PHP 8.3`         |
 | 
			
		||||
| macOS Tahoe 26.x    | arm64   | `macos-26`                         | -                 |
 | 
			
		||||
| macOS Sequoia 15.x  | arm64   | `macos-latest` or `macos-15`       | -                 |
 | 
			
		||||
| macOS Sonoma 14.x   | arm64   | `macos-14`                         | -                 |
 | 
			
		||||
| macOS Sequoia 15.x  | x86_64  | `macos-15-intel`                   | `PHP 8.3`         |
 | 
			
		||||
| macOS Ventura 13.x  | x86_64  | `macos-13`                         | `PHP 8.3`         |
 | 
			
		||||
 | 
			
		||||
### Self-Hosted Runners
 | 
			
		||||
 | 
			
		||||
@ -103,11 +104,11 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
 | 
			
		||||
 | 
			
		||||
## :tada: PHP Support
 | 
			
		||||
 | 
			
		||||
On all supported OS/Platforms the following PHP versions can be set up as per the runner.
 | 
			
		||||
On all supported OS/Platforms, the following PHP versions can be set up as per the runner.
 | 
			
		||||
 | 
			
		||||
- PHP 5.3 to PHP 8.5 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
 | 
			
		||||
- PHP 5.6 to PHP 8.5 on GitHub-hosted macOS ARM64 runners (macos-14).
 | 
			
		||||
- PHP 5.6 to PHP 8.5 on self-hosted runners.
 | 
			
		||||
- PHP 5.3 to PHP 8.6 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
 | 
			
		||||
- PHP 5.6 to PHP 8.6 on GitHub-hosted macOS ARM64 runners (macos-14).
 | 
			
		||||
- PHP 5.6 to PHP 8.6 on self-hosted runners.
 | 
			
		||||
 | 
			
		||||
| PHP Version | Stability | Release Support       | Runner Support                 |
 | 
			
		||||
|-------------|-----------|-----------------------|--------------------------------|
 | 
			
		||||
@ -126,10 +127,11 @@ On all supported OS/Platforms the following PHP versions can be set up as per th
 | 
			
		||||
| `8.3`       | `Stable`  | `Active`              | `GitHub-hosted`, `self-hosted` |
 | 
			
		||||
| `8.4`       | `Stable`  | `Active`              | `GitHub-hosted`, `self-hosted` |
 | 
			
		||||
| `8.5`       | `Nightly` | `In development`      | `GitHub-hosted`, `self-hosted` |
 | 
			
		||||
| `8.6`       | `Nightly` | `In development`      | `GitHub-hosted`, `self-hosted` |
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
> [!Note]
 | 
			
		||||
> - Specifying `8.5` in `php-version` input installs a nightly build of `PHP 8.5.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
 | 
			
		||||
> - Specifying `8.6` in `php-version` input installs a nightly build of `PHP 8.6.0-dev` from the master branch of PHP. Specifying `8.5` in `php-version` input installs a nightly build of `PHP 8.5.0-dev` from the PHP-8.5 branch of PHP. See [nightly build setup](#nightly-build-setup) for more information.
 | 
			
		||||
> - To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
 | 
			
		||||
 | 
			
		||||
## :heavy_plus_sign: PHP Extension Support
 | 
			
		||||
@ -561,10 +563,10 @@ jobs:
 | 
			
		||||
 | 
			
		||||
### Nightly Build Setup
 | 
			
		||||
 | 
			
		||||
> Set up a nightly build of `PHP 8.5`.
 | 
			
		||||
> Set up a nightly build of `PHP 8.5` or `PHP 8.6`.
 | 
			
		||||
 | 
			
		||||
- These PHP versions are currently in active development and might contain bugs and breaking changes.
 | 
			
		||||
- Some user space extensions might not support this version currently.
 | 
			
		||||
- Some user space extensions might not support these versions currently.
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
steps:
 | 
			
		||||
@ -1000,18 +1002,14 @@ Examples of using `setup-php` with various PHP frameworks and packages.
 | 
			
		||||
 | 
			
		||||
## :sparkling_heart: Support This Project
 | 
			
		||||
 | 
			
		||||
- Please star the project and share it. If you blog, please share your experience of using `setup-php`.
 | 
			
		||||
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
 | 
			
		||||
 | 
			
		||||
Many users and organisations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
 | 
			
		||||
 | 
			
		||||
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
 | 
			
		||||
 | 
			
		||||
These companies generously provide setup-php their products and services to aid in the development of this project.
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
  <a target="_blank" href="https://www.jetbrains.com/?from=setup-php">
 | 
			
		||||
    <img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="80">
 | 
			
		||||
  <a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-light-mode-only">
 | 
			
		||||
    <img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="100">
 | 
			
		||||
  </a>
 | 
			
		||||
  <a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-dark-mode-only">
 | 
			
		||||
    <img src="https://setup-php.com/sponsors/jetbrains-white.svg" alt="JetBrains" width="140" height="100">
 | 
			
		||||
  </a>
 | 
			
		||||
           
 | 
			
		||||
  <a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only">
 | 
			
		||||
@ -1028,11 +1026,22 @@ These companies generously provide setup-php their products and services to aid
 | 
			
		||||
    <img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200" height="80">
 | 
			
		||||
  </a>
 | 
			
		||||
           
 | 
			
		||||
  <a target="_blank" href="#">
 | 
			
		||||
    <img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="94" height="80">
 | 
			
		||||
  <a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-light-mode-only">
 | 
			
		||||
    <img src="https://setup-php.com/sponsors/digitalocean.svg" alt="Digitalocean" width="100" height="100">
 | 
			
		||||
  </a>
 | 
			
		||||
  <a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-dark-mode-only">
 | 
			
		||||
    <img src="https://setup-php.com/sponsors/digitalocean-white.svg" alt="Digitalocean" width="100" height="100">
 | 
			
		||||
  </a>
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
Many users and organizations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
 | 
			
		||||
 | 
			
		||||
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
 | 
			
		||||
 | 
			
		||||
- If you use setup-php, please consider starring the project and share it. 
 | 
			
		||||
- If you blog, please share your experience of using `setup-php`.
 | 
			
		||||
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
 | 
			
		||||
 | 
			
		||||
## :package: Dependencies
 | 
			
		||||
 | 
			
		||||
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
 | 
			
		||||
@ -1075,7 +1084,7 @@ These companies generously provide setup-php their products and services to aid
 | 
			
		||||
[`cs2pr`]:                    https://github.com/staabm/annotate-pull-request-from-checkstyle
 | 
			
		||||
[`deployer`]:                 https://deployer.org/
 | 
			
		||||
[`ecs`]:                      https://github.com/easy-coding-standard/easy-coding-standard
 | 
			
		||||
[`flex`]:                     https://flex.symfony.com/
 | 
			
		||||
[`flex`]:                     https://github.com/symfony/flex
 | 
			
		||||
[`grpc_php_plugin`]:          https://grpc.io/
 | 
			
		||||
[`infection`]:                https://infection.github.io/
 | 
			
		||||
[`mago`]:                     https://github.com/carthage-software/mago
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -11,7 +11,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ jobs:
 | 
			
		||||
        # blackfire-player supports PHP >= 5.5
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ jobs:
 | 
			
		||||
        # Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,7 @@ jobs:
 | 
			
		||||
        options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
@ -75,7 +75,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
@ -108,7 +108,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,7 @@ jobs:
 | 
			
		||||
        options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
@ -75,7 +75,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
@ -108,7 +108,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,7 @@ jobs:
 | 
			
		||||
    runs-on: ${{ matrix.operating-system }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
@ -47,7 +47,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
@ -79,7 +79,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ jobs:
 | 
			
		||||
    runs-on: ${{ matrix.operating-system }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ jobs:
 | 
			
		||||
    runs-on: ${{ matrix.operating-system }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,7 @@ jobs:
 | 
			
		||||
        # php-versions: ['7.0', '7.1', '7.2', '7.3']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ jobs:
 | 
			
		||||
        # php-versions: ['7.0', '7.1', '7.2', '7.3']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -12,10 +12,10 @@ jobs:
 | 
			
		||||
        node-versions: ['16']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      - name: Setup Node.js
 | 
			
		||||
        uses: actions/setup-node@v1
 | 
			
		||||
        uses: actions/setup-node@v5
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: ${{ matrix.node-versions }}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ jobs:
 | 
			
		||||
    runs-on: ${{ matrix.operating-system }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0', '8.1']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      # Docs: https://github.com/shivammathur/setup-php
 | 
			
		||||
      - name: Setup PHP
 | 
			
		||||
 | 
			
		||||
@ -29,10 +29,10 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      - name: Set Node.js 10.x
 | 
			
		||||
        uses: actions/setup-node@v1
 | 
			
		||||
        uses: actions/setup-node@v5
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 10.x
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -29,10 +29,10 @@ jobs:
 | 
			
		||||
        php-versions: ['7.4', '8.0']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
        uses: actions/checkout@v5
 | 
			
		||||
 | 
			
		||||
      - name: Set Node.js 10.x
 | 
			
		||||
        uses: actions/setup-node@v1
 | 
			
		||||
        uses: actions/setup-node@v5
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 10.x
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
  "highest": "8.4",
 | 
			
		||||
  "latest": "8.4",
 | 
			
		||||
  "nightly": "8.5",
 | 
			
		||||
  "master": "8.6",
 | 
			
		||||
  "5.x": "5.6",
 | 
			
		||||
  "7.x": "7.4",
 | 
			
		||||
  "8.x": "8.4"
 | 
			
		||||
 | 
			
		||||
@ -266,7 +266,8 @@
 | 
			
		||||
    "type": "custom-package",
 | 
			
		||||
    "repository": "symfony-cli/symfony-cli",
 | 
			
		||||
    "domain": "https://github.com",
 | 
			
		||||
    "version_prefix": "-V"
 | 
			
		||||
    "version_prefix": "v",
 | 
			
		||||
    "version_parameter": "-V"
 | 
			
		||||
  },
 | 
			
		||||
  "blackfire-player": {
 | 
			
		||||
    "type": "custom-function",
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,9 @@ export async function addExtensionDarwin(
 | 
			
		||||
      // match 5.3ioncube...8.4ioncube
 | 
			
		||||
      // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
 | 
			
		||||
      // match 7.0zephir_parser...8.4zephir_parser
 | 
			
		||||
      case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
 | 
			
		||||
      case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
 | 
			
		||||
        version_extension
 | 
			
		||||
      ):
 | 
			
		||||
      case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
 | 
			
		||||
        version_extension
 | 
			
		||||
      ):
 | 
			
		||||
@ -271,7 +273,9 @@ export async function addExtensionLinux(
 | 
			
		||||
      // match 5.3ioncube...8.4ioncube
 | 
			
		||||
      // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
 | 
			
		||||
      // match 7.0zephir_parser...8.4zephir_parser
 | 
			
		||||
      case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
 | 
			
		||||
      case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
 | 
			
		||||
        version_extension
 | 
			
		||||
      ):
 | 
			
		||||
      case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
 | 
			
		||||
        version_extension
 | 
			
		||||
      ):
 | 
			
		||||
 | 
			
		||||
@ -148,9 +148,9 @@ get_brewed_php() {
 | 
			
		||||
  cellar="$brew_prefix"/Cellar
 | 
			
		||||
  php_cellar="$cellar"/php
 | 
			
		||||
  if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
 | 
			
		||||
    php_semver | cut -c 1-3
 | 
			
		||||
    php_semver
 | 
			
		||||
  elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
 | 
			
		||||
    php_semver | cut -c 1-3
 | 
			
		||||
    php_semver
 | 
			
		||||
  else
 | 
			
		||||
    echo 'false';
 | 
			
		||||
  fi
 | 
			
		||||
@ -160,17 +160,24 @@ get_brewed_php() {
 | 
			
		||||
add_php() {
 | 
			
		||||
  action=$1
 | 
			
		||||
  existing_version=$2
 | 
			
		||||
  add_brew_tap "$php_tap"
 | 
			
		||||
  update_dependencies
 | 
			
		||||
  suffix="$(get_php_formula_suffix)"
 | 
			
		||||
  php_formula="shivammathur/php/php@$version$suffix"
 | 
			
		||||
  php_keg="php@$version$suffix"
 | 
			
		||||
  php_formula="shivammathur/php/$php_keg"
 | 
			
		||||
  if [[ "$existing_version" = "false" || -n "$suffix" || "$action" = "upgrade" ]]; then
 | 
			
		||||
    update_dependencies
 | 
			
		||||
    add_brew_tap
 | 
			
		||||
  fi
 | 
			
		||||
  if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
 | 
			
		||||
    ([ "$action" = "upgrade" ] && brew upgrade -f --overwrite "$php_formula") || brew unlink "$php_formula"
 | 
			
		||||
    if [ "$action" = "upgrade" ]; then
 | 
			
		||||
      brew upgrade -f --overwrite "$php_formula"
 | 
			
		||||
    else
 | 
			
		||||
      brew unlink "$php_keg"
 | 
			
		||||
    fi
 | 
			
		||||
  else
 | 
			
		||||
    brew install -f --overwrite "$php_formula"
 | 
			
		||||
  fi
 | 
			
		||||
  sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix"
 | 
			
		||||
  brew link --force --overwrite "$php_formula"
 | 
			
		||||
  brew link --force --overwrite "$php_keg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to get formula suffix
 | 
			
		||||
@ -222,18 +229,18 @@ setup_php() {
 | 
			
		||||
  update=true
 | 
			
		||||
  check_pre_installed
 | 
			
		||||
  existing_version=$(get_brewed_php)
 | 
			
		||||
  status="Found"
 | 
			
		||||
  if [[ "$version" =~ ${old_versions:?} ]]; then
 | 
			
		||||
    run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
 | 
			
		||||
    status="Installed"
 | 
			
		||||
  elif [ "$existing_version" != "$version" ]; then
 | 
			
		||||
  elif [ "${existing_version:0:3}" != "$version" ]; then
 | 
			
		||||
    add_php "install" "$existing_version" >/dev/null 2>&1
 | 
			
		||||
    status="Installed"
 | 
			
		||||
  elif [ "$existing_version" = "$version" ]; then
 | 
			
		||||
    if [ "${update:?}" = "true" ]; then
 | 
			
		||||
  elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
 | 
			
		||||
    brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
 | 
			
		||||
    if [ "$brew_php_version" != "$existing_version" ]; then
 | 
			
		||||
      add_php "upgrade" "$existing_version" >/dev/null 2>&1
 | 
			
		||||
      status="Updated to"
 | 
			
		||||
    else
 | 
			
		||||
      status="Found"
 | 
			
		||||
      status="Upgraded"
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
  php_config="$(command -v php-config)"
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,10 @@
 | 
			
		||||
# Function to log result of installing extension.
 | 
			
		||||
add_extension_log() {
 | 
			
		||||
  (
 | 
			
		||||
    check_extension "$(echo "$1" | cut -d '-' -f 1)" && add_log "${tick:?}" "$1" "$2"
 | 
			
		||||
  ) || add_log "${cross:?}" "$1" "Could not install $1 on PHP ${semver:?}"
 | 
			
		||||
  if check_extension ${1%%-*}; then
 | 
			
		||||
    add_log "${tick:?}" "$1" "$2"
 | 
			
		||||
  else
 | 
			
		||||
    add_log "${cross:?}" "$1" "${3:-Could not install $1 on PHP ${semver:?}}"
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to test if extension is loaded.
 | 
			
		||||
 | 
			
		||||
@ -2,11 +2,9 @@
 | 
			
		||||
get_relay_version() {
 | 
			
		||||
 local ext=$1
 | 
			
		||||
  if [[ "$ext" =~ ^relay$ ]]; then
 | 
			
		||||
    if [ "${version:?}" = "7.4" ]; then
 | 
			
		||||
      echo 'v0.7.0'
 | 
			
		||||
    else
 | 
			
		||||
      get -s -n "" "${relay_releases:?}"/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2
 | 
			
		||||
    fi
 | 
			
		||||
    get -s -n "" "${relay_release:?}"
 | 
			
		||||
  elif [[ $ext =~ ^relay-nightly$ ]]; then
 | 
			
		||||
    echo "dev"
 | 
			
		||||
  else
 | 
			
		||||
    relay_version="${ext##*-}"
 | 
			
		||||
    echo "v${relay_version/v//}"
 | 
			
		||||
@ -48,19 +46,6 @@ change_library_paths() {
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Add hiredis library
 | 
			
		||||
add_hiredis_1.1.0() {
 | 
			
		||||
  hiredis_url=https://github.com/redis/hiredis/archive/v1.1.0.tar.gz
 | 
			
		||||
  hiredis_sha=fe6d21741ec7f3fc9df409d921f47dfc73a4d8ff64f4ac6f1d95f951bf7f53d6
 | 
			
		||||
  sed -Ei.bak -e "s#^  url.*#  url \"$hiredis_url\"#" -e "s#^  sha256.*#  sha256 \"$hiredis_sha\"#" ${core_repo:?}/Formula/h/hiredis.rb
 | 
			
		||||
  brew install -s hiredis
 | 
			
		||||
  lib_dir="${brew_prefix:?}"/opt/hiredis/lib
 | 
			
		||||
  if [ -e "$lib_dir"/libhiredis_ssl.1.1.0.dylib ]; then
 | 
			
		||||
    sudo ln -sf "$lib_dir"/libhiredis_ssl.1.1.0.dylib "$lib_dir"/libhiredis_ssl.dylib.1.1.0
 | 
			
		||||
  fi
 | 
			
		||||
  mv ${core_repo:?}/Formula/h/hiredis.rb.bak ${core_repo:?}/Formula/h/hiredis.rb
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Add relay dependencies
 | 
			
		||||
add_relay_dependencies() {
 | 
			
		||||
  add_extension json
 | 
			
		||||
@ -69,12 +54,7 @@ add_relay_dependencies() {
 | 
			
		||||
  if [ "$os" = "Darwin" ]; then
 | 
			
		||||
    . "${0%/*}"/tools/brew.sh
 | 
			
		||||
    configure_brew
 | 
			
		||||
    if [ "$relay_version" = "v0.7.0" ]; then
 | 
			
		||||
      brew install lz4 zstd concurrencykit
 | 
			
		||||
      add_hiredis_1.1.0 >/dev/null 2>&1
 | 
			
		||||
    else
 | 
			
		||||
      brew install lz4 hiredis zstd concurrencykit
 | 
			
		||||
    fi
 | 
			
		||||
    brew install lz4 hiredis zstd concurrencykit
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -128,7 +108,7 @@ configure_relay() {
 | 
			
		||||
 | 
			
		||||
# Helper function to add relay extension
 | 
			
		||||
add_relay_helper() {
 | 
			
		||||
  arch="$(uname -m | sed 's/_/-/')"
 | 
			
		||||
  local arch=$1
 | 
			
		||||
  os_suffix="$(get_os_suffix)"
 | 
			
		||||
  openssl_suffix="$(get_openssl_suffix)"
 | 
			
		||||
  artifact_file_name="relay-$relay_version-php${version:?}-$os_suffix-$arch$openssl_suffix.tar.gz"
 | 
			
		||||
@ -152,17 +132,24 @@ add_relay() {
 | 
			
		||||
  local ext=$1
 | 
			
		||||
  local arch
 | 
			
		||||
  local url
 | 
			
		||||
  local message
 | 
			
		||||
  local error
 | 
			
		||||
  os=$(uname -s)
 | 
			
		||||
  relay_releases=https://github.com/cachewerk/relay/releases
 | 
			
		||||
  arch="$(uname -m | sed 's/_/-/')"
 | 
			
		||||
  relay_release=https://builds.r2.relay.so/meta/latest
 | 
			
		||||
  relay_trunk=https://builds.r2.relay.so
 | 
			
		||||
  relay_version=$(get_relay_version "$ext")
 | 
			
		||||
  add_relay_dependencies >/dev/null 2>&1
 | 
			
		||||
  if shared_extension relay; then
 | 
			
		||||
    message="Enabled"
 | 
			
		||||
  if [[ "$arch" = "x86-64" && "$os" = "Darwin" ]]; then
 | 
			
		||||
    error="Relay extension is not available for macOS x86_64 architecture"
 | 
			
		||||
  else
 | 
			
		||||
    add_relay_helper >/dev/null 2>&1
 | 
			
		||||
    message="Installed and enabled"
 | 
			
		||||
    relay_version=$(get_relay_version "$ext")
 | 
			
		||||
    add_relay_dependencies >/dev/null 2>&1
 | 
			
		||||
    if shared_extension relay; then
 | 
			
		||||
      message="Enabled"
 | 
			
		||||
    else
 | 
			
		||||
      add_relay_helper "$arch" >/dev/null 2>&1
 | 
			
		||||
      message="Installed and enabled ${relay_version}"
 | 
			
		||||
    fi
 | 
			
		||||
    configure_relay >/dev/null 2>&1
 | 
			
		||||
  fi
 | 
			
		||||
  configure_relay >/dev/null 2>&1
 | 
			
		||||
  add_extension_log relay "$message"
 | 
			
		||||
  add_extension_log relay "$message" "$error"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -119,9 +119,10 @@ fetch_extension() {
 | 
			
		||||
  elif [ "$fetch" = "pecl" ]; then
 | 
			
		||||
    source="pecl"
 | 
			
		||||
    pecl_name=${extension/http/pecl_http}
 | 
			
		||||
    get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz
 | 
			
		||||
    capital_pecl_name=$(echo "$pecl_name" | tr '[:lower:]' '[:upper:]')
 | 
			
		||||
    get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz https://pecl.php.net/get/"$capital_pecl_name"-"$release".tgz
 | 
			
		||||
    tar -xzf /tmp/"$pecl_name".tgz -C /tmp
 | 
			
		||||
    cd /tmp/"$pecl_name"-"$release" || exit
 | 
			
		||||
    cd /tmp/"$pecl_name"-"$release" 2>/dev/null || cd /tmp/"$capital_pecl_name"-"$release" 2>/dev/null || exit
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -50,12 +50,23 @@ update_lists_helper() {
 | 
			
		||||
update_lists() {
 | 
			
		||||
  local ppa=${1:-}
 | 
			
		||||
  local ppa_search=${2:-}
 | 
			
		||||
  local status_token=${3:-$ppa_search}
 | 
			
		||||
  local list=
 | 
			
		||||
  status_file=/tmp/os_lists
 | 
			
		||||
  local status_file=/tmp/os_lists
 | 
			
		||||
  local hash_cmd
 | 
			
		||||
  if [[ -n "$ppa" && -n "$ppa_search" ]]; then
 | 
			
		||||
    list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
 | 
			
		||||
    status_file=/tmp/"$(echo -n "$ppa_search" | shasum -a 256 | cut -d ' ' -f 1)"
 | 
			
		||||
  elif [ -e "$list_file" ] && grep -Eq '^deb |^Types deb' "$list_file"; then
 | 
			
		||||
    if [ -f "$ppa_search" ]; then
 | 
			
		||||
      list="$ppa_search"
 | 
			
		||||
    else
 | 
			
		||||
      list="$(grep -Elr "$ppa_search" "$list_dir" 2>/dev/null | head -n 1)"
 | 
			
		||||
    fi
 | 
			
		||||
    hash_cmd="$(command -v sha256sum || command -v shasum)"
 | 
			
		||||
    if [ -n "$status_token" ] && [ -n "$hash_cmd" ]; then
 | 
			
		||||
      status_file=/tmp/os_lists_"$(echo -n "$status_token" | $hash_cmd | awk '{print $1}')"
 | 
			
		||||
    elif [ -n "$status_token" ]; then
 | 
			
		||||
      status_file=/tmp/os_lists_$(date +%s)
 | 
			
		||||
    fi
 | 
			
		||||
  elif [ -e "$list_file" ] && grep -Eq '^deb |^Types: *deb' "$list_file"; then
 | 
			
		||||
    list="$list_file"
 | 
			
		||||
  fi
 | 
			
		||||
  if [ ! -e "$status_file" ]; then
 | 
			
		||||
@ -64,6 +75,67 @@ update_lists() {
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Determine whether deb822 sources are the default on this system.
 | 
			
		||||
get_sources_format() {
 | 
			
		||||
  if [ -n "$sources_format" ]; then
 | 
			
		||||
    echo "$sources_format"
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
  sources_format=deb
 | 
			
		||||
  if [ -e "$list_dir"/ubuntu.sources ] || [ -e "$list_dir"/debian.sources ]; then
 | 
			
		||||
    sources_format="deb822"
 | 
			
		||||
  elif ! [[ "$ID" =~ ubuntu|debian ]]; then
 | 
			
		||||
    find "$list_dir" -type f -name '*.sources' | grep -q . && sources_format="deb822"
 | 
			
		||||
  fi
 | 
			
		||||
  echo "$sources_format"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
escape_regex() {
 | 
			
		||||
  printf '%s' "$1" | sed -e 's/[][\.^$*+?{}()|\/]/\\&/g'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
merge_components() {
 | 
			
		||||
  local out=() t
 | 
			
		||||
  for t in $1 $2; do [[ $t && " ${out[*]} " != *" $t "* ]] && out+=("$t"); done
 | 
			
		||||
  printf '%s\n' "${out[*]}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
merge_components_from_file() {
 | 
			
		||||
  local path=$1
 | 
			
		||||
  local incoming=$2
 | 
			
		||||
  local current=
 | 
			
		||||
  if [ -n "$path" ] && [ -e "$path" ]; then
 | 
			
		||||
    current="$(grep -E '^Components:' "$path" | head -n 1 | cut -d ':' -f 2 | xargs)"
 | 
			
		||||
  fi
 | 
			
		||||
  local merged
 | 
			
		||||
  merged="$(merge_components "$current" "$incoming")"
 | 
			
		||||
  if [ -z "$merged" ] || [ "$merged" = "$current" ]; then
 | 
			
		||||
    return 1
 | 
			
		||||
  fi
 | 
			
		||||
  printf '%s\n' "$merged"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to get repo patterns based on format.
 | 
			
		||||
get_repo_patterns() {
 | 
			
		||||
  local list_format=$1
 | 
			
		||||
  local ppa_url=$2
 | 
			
		||||
  local package_dist=$3
 | 
			
		||||
  local branches=$4
 | 
			
		||||
  local escaped_url
 | 
			
		||||
  local escaped_dist
 | 
			
		||||
  local escaped_branches
 | 
			
		||||
  escaped_url="$(escape_regex "$ppa_url")"
 | 
			
		||||
  escaped_dist="$(escape_regex "$package_dist")"
 | 
			
		||||
  escaped_branches="$(escape_regex "$branches")"
 | 
			
		||||
  local deb_pattern="^deb .*${escaped_url} ${escaped_dist} .*${escaped_branches}$"
 | 
			
		||||
  local deb822_pattern="^URIs: ${escaped_url}$"
 | 
			
		||||
  if [ "$list_format" = "deb822" ]; then
 | 
			
		||||
    printf '%s|%s\n' "$deb822_pattern" "$deb_pattern"
 | 
			
		||||
  else
 | 
			
		||||
    printf '%s|%s\n' "$deb_pattern" "$deb822_pattern"
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to get fingerprint from an Ubuntu PPA.
 | 
			
		||||
ubuntu_fingerprint() {
 | 
			
		||||
  ppa="$1"
 | 
			
		||||
@ -104,19 +176,78 @@ add_key() {
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
handle_existing_list() {
 | 
			
		||||
  local ppa=$1
 | 
			
		||||
  local list_format=$2
 | 
			
		||||
  branches=$3
 | 
			
		||||
  [[ "$list_format" = "deb822"  && -n "$check_lists_file" ]] || {
 | 
			
		||||
    echo "Repository $ppa ($branches) already exists"
 | 
			
		||||
    return 1
 | 
			
		||||
  }
 | 
			
		||||
  [[ "$check_lists_file" = *.list ]] && {
 | 
			
		||||
    sudo rm -f "$check_lists_file"
 | 
			
		||||
    return 0
 | 
			
		||||
  }
 | 
			
		||||
  local merged_components
 | 
			
		||||
  merged_components="$(merge_components_from_file "$check_lists_file" "$branches")" && {
 | 
			
		||||
    sudo rm -f "$check_lists_file"
 | 
			
		||||
    branches="$merged_components"
 | 
			
		||||
    return 0
 | 
			
		||||
  }
 | 
			
		||||
  echo "Repository $ppa ($branches) already exists"
 | 
			
		||||
  return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to write a list file.
 | 
			
		||||
write_list() {
 | 
			
		||||
  local type=$1
 | 
			
		||||
  local ppa=$2
 | 
			
		||||
  local url=$3
 | 
			
		||||
  local suite=$4
 | 
			
		||||
  local components=$5
 | 
			
		||||
  local key_file=$6
 | 
			
		||||
  local list_basename="${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$suite"
 | 
			
		||||
  local arch
 | 
			
		||||
  arch="$(dpkg --print-architecture)"
 | 
			
		||||
  sudo rm -f "$list_dir"/"${ppa/\//-}".list "$list_dir"/"${ppa/\//-}".sources "$list_dir"/"$list_basename".list "$list_dir"/"$list_basename".sources || true
 | 
			
		||||
  if [ "$type" = "deb822" ]; then
 | 
			
		||||
    cat <<EOF | sudo tee "$list_dir"/"$list_basename".sources >/dev/null
 | 
			
		||||
Types: deb
 | 
			
		||||
URIs: $url
 | 
			
		||||
Suites: $suite
 | 
			
		||||
Components: $components
 | 
			
		||||
Architectures: $arch
 | 
			
		||||
Signed-By: $key_file
 | 
			
		||||
EOF
 | 
			
		||||
  else
 | 
			
		||||
    echo "deb [arch=$arch signed-by=$key_file] $url $suite $components" | sudo tee "$list_dir"/"$list_basename".list >/dev/null 2>&1
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to check if a PPA and its lists exist
 | 
			
		||||
check_lists() {
 | 
			
		||||
  ppa=$1
 | 
			
		||||
  ppa_search=$2
 | 
			
		||||
  if grep -Eqr "$ppa_search" "$list_dir"; then
 | 
			
		||||
  local ppa=$1
 | 
			
		||||
  local primary=${2:-}
 | 
			
		||||
  local secondary=${3:-}
 | 
			
		||||
  local status_token=${4:-$primary}
 | 
			
		||||
  local match_file=
 | 
			
		||||
  check_lists_file=
 | 
			
		||||
  if [ -n "$primary" ]; then
 | 
			
		||||
    match_file=$(grep -Elr "$primary" "$list_dir" 2>/dev/null | head -n 1)
 | 
			
		||||
  fi
 | 
			
		||||
  if [ -z "$match_file" ] && [ -n "$secondary" ]; then
 | 
			
		||||
    match_file=$(grep -Elr "$secondary" "$list_dir" 2>/dev/null | head -n 1)
 | 
			
		||||
  fi
 | 
			
		||||
  if [ -n "$match_file" ]; then
 | 
			
		||||
    local list_count
 | 
			
		||||
    list_count="$(sudo find /var/lib/apt/lists -type f -name "*${ppa/\//_}*" | wc -l)"
 | 
			
		||||
    if [ "$list_count" = "0" ]; then
 | 
			
		||||
      update_lists "$ppa" "$ppa_search"
 | 
			
		||||
      update_lists "$ppa" "$match_file" "$status_token"
 | 
			
		||||
    fi
 | 
			
		||||
    return 0;
 | 
			
		||||
  else
 | 
			
		||||
    return 1;
 | 
			
		||||
    check_lists_file="$match_file"
 | 
			
		||||
    return 0
 | 
			
		||||
  fi
 | 
			
		||||
  return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to add a sources list.
 | 
			
		||||
@ -126,19 +257,24 @@ add_list() {
 | 
			
		||||
  key_source=${3:-"$ppa_url"}
 | 
			
		||||
  package_dist=${4:-"$VERSION_CODENAME"}
 | 
			
		||||
  branches=${5:-main}
 | 
			
		||||
  ppa_search="deb .*$ppa_url $package_dist .*$branches$"
 | 
			
		||||
  if check_lists "$ppa" "$ppa_search"; then
 | 
			
		||||
    echo "Repository $ppa already exists";
 | 
			
		||||
    return 1;
 | 
			
		||||
  else
 | 
			
		||||
    arch=$(dpkg --print-architecture)
 | 
			
		||||
    [ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
 | 
			
		||||
    add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
 | 
			
		||||
    sudo rm -rf "$list_dir"/"${ppa/\//-}".list || true
 | 
			
		||||
    echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$package_dist".list >/dev/null 2>&1
 | 
			
		||||
    update_lists "$ppa" "$ppa_search"
 | 
			
		||||
    . /etc/os-release
 | 
			
		||||
  local list_format
 | 
			
		||||
  list_format="$(get_sources_format)"
 | 
			
		||||
  local status_token
 | 
			
		||||
  status_token="${ppa_url}|${package_dist}|${branches}"
 | 
			
		||||
  local list_path=
 | 
			
		||||
  IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
 | 
			
		||||
  if check_lists "$ppa" "$primary_pattern" "$secondary_pattern" "$status_token"; then
 | 
			
		||||
    list_path="$check_lists_file"
 | 
			
		||||
    handle_existing_list "$ppa" "$list_format" "$branches" || return 1;
 | 
			
		||||
    check_lists_file=
 | 
			
		||||
    IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
 | 
			
		||||
    status_token="${ppa_url}|${package_dist}|${branches}"
 | 
			
		||||
  fi
 | 
			
		||||
  [ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
 | 
			
		||||
  add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
 | 
			
		||||
  write_list "$list_format" "$ppa" "$ppa_url" "$package_dist" "$branches" "$key_file"
 | 
			
		||||
  update_lists "$ppa" "$primary_pattern" "$status_token"
 | 
			
		||||
  . /etc/os-release
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -148,8 +284,12 @@ check_ppa() {
 | 
			
		||||
  ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
 | 
			
		||||
  package_dist=${3:-"$VERSION_CODENAME"}
 | 
			
		||||
  branches=${4:-main}
 | 
			
		||||
  ppa_search="deb .*$ppa_url $package_dist .*$branches$"
 | 
			
		||||
  if check_lists "$ppa" "$ppa_search"; then
 | 
			
		||||
  local list_format
 | 
			
		||||
  list_format="$(get_sources_format)"
 | 
			
		||||
  IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
 | 
			
		||||
  local status_token
 | 
			
		||||
  status_token="${ppa_url}|${package_dist}|${branches}"
 | 
			
		||||
  if check_lists "$ppa" "$primary_pattern" "$secondary_pattern" "$status_token"; then
 | 
			
		||||
    return 0;
 | 
			
		||||
  else
 | 
			
		||||
    return 1;
 | 
			
		||||
@ -163,7 +303,7 @@ remove_list() {
 | 
			
		||||
  for ppa_url in "${ppa_urls[@]}"; do
 | 
			
		||||
    grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
 | 
			
		||||
  done
 | 
			
		||||
  sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring || true
 | 
			
		||||
  sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring /tmp/os_lists* || true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Function to check if ubuntu ppa is up
 | 
			
		||||
@ -213,12 +353,23 @@ update_ppa() {
 | 
			
		||||
  ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
 | 
			
		||||
  package_dist=${4:-"$VERSION_CODENAME"}
 | 
			
		||||
  branches=${5:-main}
 | 
			
		||||
  ppa_search="deb .*$ppa_url $package_dist .*$branches"
 | 
			
		||||
  update_lists "$ppa" "$ppa_search"
 | 
			
		||||
  local list_format
 | 
			
		||||
  list_format="$(get_sources_format)"
 | 
			
		||||
  IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
 | 
			
		||||
  local list_path
 | 
			
		||||
  list_path="$(grep -Elr "$primary_pattern" "$list_dir" 2>/dev/null | head -n 1)"
 | 
			
		||||
  if [ -z "$list_path" ] && [ -n "$secondary_pattern" ]; then
 | 
			
		||||
    list_path="$(grep -Elr "$secondary_pattern" "$list_dir" 2>/dev/null | head -n 1)"
 | 
			
		||||
  fi
 | 
			
		||||
  local status_token
 | 
			
		||||
  status_token="${ppa_url}|${package_dist}|${branches}"
 | 
			
		||||
  update_lists "$ppa" "${list_path:-$primary_pattern}" "$status_token"
 | 
			
		||||
  . /etc/os-release
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Variables
 | 
			
		||||
sources_format=
 | 
			
		||||
check_lists_file=
 | 
			
		||||
list_dir='/etc/apt/sources.list.d'
 | 
			
		||||
list_file="/etc/apt/sources.list.d/$ID.sources"
 | 
			
		||||
[ -e "$list_file" ] || list_file='/etc/apt/sources.list'
 | 
			
		||||
 | 
			
		||||
@ -1,18 +1,32 @@
 | 
			
		||||
Function Add-Symfony() {
 | 
			
		||||
  $arch_name ='amd64'
 | 
			
		||||
  if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
 | 
			
		||||
    $arch_name = '386'
 | 
			
		||||
  }
 | 
			
		||||
  $url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
 | 
			
		||||
  Get-File -Url $url -OutFile $bin_dir\symfony.zip >$null 2>&1
 | 
			
		||||
  Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
 | 
			
		||||
  if(Test-Path $bin_dir\symfony.exe) {
 | 
			
		||||
    Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
 | 
			
		||||
    Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
 | 
			
		||||
    Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
 | 
			
		||||
    $tool_version = Get-ToolVersion symfony "-V"
 | 
			
		||||
    Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
 | 
			
		||||
  param(
 | 
			
		||||
    [Parameter(Mandatory = $true, Position = 0, HelpMessage = 'Symfony version to be installed')]
 | 
			
		||||
    [string] $protobuf_tag
 | 
			
		||||
  )
 | 
			
		||||
  $protobuf_tag = $protobuf_tag.replace('v', '')
 | 
			
		||||
  if($protobuf_tag -ne 'latest' -and $protobuf_tag -notmatch '^\d+(\.\d+)*$') {
 | 
			
		||||
    Add-Log $cross "symfony-cli" "Invalid symfony version: $protobuf_tag"
 | 
			
		||||
  } else {
 | 
			
		||||
    Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
 | 
			
		||||
    $arch_name = 'amd64'
 | 
			
		||||
    if (-not ([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
 | 
			
		||||
      $arch_name = '386'
 | 
			
		||||
    }
 | 
			
		||||
    $symfony_releases = "https://github.com/symfony-cli/symfony-cli/releases"
 | 
			
		||||
    if ($protobuf_tag -eq 'latest') {
 | 
			
		||||
      $url = "$symfony_releases/latest/download/symfony-cli_windows_${arch_name}.zip"
 | 
			
		||||
    } else {
 | 
			
		||||
      $url = "$symfony_releases/download/v$protobuf_tag/symfony-cli_windows_${arch_name}.zip"
 | 
			
		||||
    }
 | 
			
		||||
    Get-File -Url $url -OutFile $bin_dir\symfony.zip > $null 2>&1
 | 
			
		||||
    Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force > $null 2>&1
 | 
			
		||||
    if (Test-Path $bin_dir\symfony.exe) {
 | 
			
		||||
      Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
 | 
			
		||||
      Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
 | 
			
		||||
      Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
 | 
			
		||||
      $tool_version = Get-ToolVersion symfony "-V"
 | 
			
		||||
      Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
 | 
			
		||||
    } else {
 | 
			
		||||
      Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,41 +1,44 @@
 | 
			
		||||
add_symfony_with_brew() {
 | 
			
		||||
  add_brew_tap symfony-cli/homebrew-tap
 | 
			
		||||
  brew install symfony-cli/tap/symfony-cli
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
get_symfony_artifact_url() {
 | 
			
		||||
    arch=$(dpkg --print-architecture)
 | 
			
		||||
    url=$(get -s -n "" https://raw.githubusercontent.com/symfony-cli/homebrew-tap/main/Formula/symfony-cli.rb 2<&1 | grep -m 1 "url.*linux.*${arch}" | cut -d\" -f 2)
 | 
			
		||||
    if [ -z "$url" ]; then
 | 
			
		||||
      url=$(get -s -n "" https://api.github.com/repos/symfony-cli/symfony-cli/releases 2<&1 | grep -m 1 "url.*linux.*${arch}.*gz\"" | cut -d\" -f 4)
 | 
			
		||||
    fi
 | 
			
		||||
    echo "$url"
 | 
			
		||||
  local symfony_tag=$1
 | 
			
		||||
  local os
 | 
			
		||||
  local arch
 | 
			
		||||
  os="$(uname -s | tr '[:upper:]' '[:lower:]')"
 | 
			
		||||
  arch="$(uname -m)"
 | 
			
		||||
  case "$arch" in
 | 
			
		||||
    arm|armv6*|armv7*) arch="armv6" ;;
 | 
			
		||||
    aarch64*|armv8*|arm64) arch="arm64" ;;
 | 
			
		||||
    i[36]86) arch="386" ;;
 | 
			
		||||
    x86_64|amd64) arch="amd64" ;;
 | 
			
		||||
  esac
 | 
			
		||||
  [ "$os" = "darwin" ] && arch="all"
 | 
			
		||||
  symfony_releases="https://github.com/symfony-cli/symfony-cli/releases"
 | 
			
		||||
  if [ "$symfony_tag" = "latest" ]; then
 | 
			
		||||
    echo "$symfony_releases/latest/download/symfony-cli_${os}_${arch}.tar.gz"
 | 
			
		||||
  else
 | 
			
		||||
    echo "$symfony_releases/download/v$symfony_tag/symfony-cli_${os}_${arch}.tar.gz"
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
add_symfony_helper() {
 | 
			
		||||
  if [ "$(uname -s)" = "Linux" ]; then
 | 
			
		||||
    url="$(get_symfony_artifact_url)"
 | 
			
		||||
    if [ -z "$url" ]; then
 | 
			
		||||
      . "${0%/*}"/tools/brew.sh
 | 
			
		||||
      configure_brew
 | 
			
		||||
      add_symfony_with_brew
 | 
			
		||||
    else
 | 
			
		||||
      get -s -n "" "$url" | sudo tar -xz -C "${tool_path_dir:?}" 2>/dev/null
 | 
			
		||||
      sudo chmod a+x /usr/local/bin/symfony
 | 
			
		||||
    fi
 | 
			
		||||
  elif [ "$(uname -s)" = "Darwin" ]; then
 | 
			
		||||
    add_symfony_with_brew
 | 
			
		||||
  fi
 | 
			
		||||
  local install_dir=/usr/local/bin
 | 
			
		||||
  [ "$(uname -s)" = "Darwin" ] && install_dir=${brew_prefix:?}/bin
 | 
			
		||||
  get -s -n "" "$(get_symfony_artifact_url "$symfony_tag")" | sudo tar -xz -C "$install_dir" 2>/dev/null
 | 
			
		||||
  sudo chmod a+x "$install_dir"/symfony
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
add_symfony() {
 | 
			
		||||
  add_symfony_helper >/dev/null 2>&1
 | 
			
		||||
  symfony_path="$(command -v symfony)"
 | 
			
		||||
  if [[ -n "$symfony_path" ]]; then
 | 
			
		||||
    sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
 | 
			
		||||
    tool_version=$(get_tool_version "symfony" "-V")
 | 
			
		||||
    add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
 | 
			
		||||
  local symfony_tag="${1/v/}"
 | 
			
		||||
  if ! [[ "$symfony_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$symfony_tag" == 'latest' ]]; then
 | 
			
		||||
      add_log "${cross:?}" "symfony-cli" "Version '$symfony_tag' is not valid for symfony-cli"
 | 
			
		||||
  else
 | 
			
		||||
    add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
 | 
			
		||||
    add_symfony_helper "$symfony_tag" >/dev/null 2>&1
 | 
			
		||||
    symfony_path="$(command -v symfony)"
 | 
			
		||||
    if [[ -n "$symfony_path" ]]; then
 | 
			
		||||
      sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
 | 
			
		||||
      tool_version=$(get_tool_version "symfony" "-V")
 | 
			
		||||
      add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
 | 
			
		||||
    else
 | 
			
		||||
      add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user