Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider determining and enabling PHP extensions depending on requirements in composer.json #713

Closed
1 task done
localheinz opened this issue Mar 17, 2023 · 3 comments
Closed
1 task done
Assignees
Labels
enhancement New feature or request

Comments

@localheinz
Copy link
Contributor

Describe the feature

Similar to #629, perhaps it would be useful to disable all PHP extensions, and determine and enable PHP extensions depending on requirements in composer.json.

I understand that this could be a bit problematic, because some could have dependencies on PHP extensions that are not directly or indirectly documented in composer.json, for example:

  • for running PHARs
  • required by PHARs
  • recommended by PHARs

Version

  • I have checked releases, and the feature is missing in the latest patch version of v2.

Underlying issue
n/a

Describe alternatives
Alternatives include manually disabling and then enabling all required PHP extensions.

Additional context
n/a

Are you willing to submit a PR?
n/a

@localheinz localheinz added the enhancement New feature or request label Mar 17, 2023
@shivammathur
Copy link
Owner

I'm open to a PR that adds extensions based on composer.json.

We can add an input like extensions-file that supports composer.json as an input along with any file with a list of extensions.

This can be combined with none in the extensions input to have the desired effect. But that can be dangerous as you mentioned removing all extensions might break phar tools that are used in the pipeline in case they are not in composer.json.

Handling that would be the responsibility of the user. The action does try to enable extensions that are required for the supported tools though.

@localheinz
Copy link
Contributor Author

Thank you for your feedback, @shivammathur - perhaps it's too much work and not worth the effort, given the complications.

@jasongill
Copy link
Contributor

We use Composer's built in platform config option to force our local environments and development environments to match our production server version.

This makes it easy to grab the appropriate version from composer.json and pass it to php-setup:

      - name: Get required PHP version
        uses: sergeysova/jq-action@v2
        id: php_version
        with:
          cmd: |
            jq '.config.platform.php' composer.json -r
      - name: Setup PHP runtime
        uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ steps.php_version.outputs.value }}"

Hope this helps someone else who is trying to find a way to force setup-php to match their configuration without having to keep their github actions yml up to date.

Repository owner locked and limited conversation to collaborators Jan 4, 2024
@shivammathur shivammathur converted this issue into discussion #808 Jan 4, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants