Skip to content
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

Use symfony CLI for running PHP when available #311

Merged

Conversation

nussjustin-hmmh
Copy link
Contributor

Right now there is no easy way to choose a PHP version / installation for use by shopware-cli. This can be a problem when working on multiple projects with different required PHP versions.

Symfony's CLI tool can automatically detect the correct PHP version / installation to use for a project based on (among other things) a .php-version file or the required PHP version from composer.json files.

This PHP version can than be used by running symfony php instead of php. Similarly there is also a symfony composer command for running composer with the correct PHP version and even a symfony console command for running the bin/console tool.

We can use this to easily support different PHP versions.

This PR introduces a new internal/phpexec package for creating commands for running PHP, composer and bin/console which will automatically use the Symfony CLI if available.

It also updates the existing code to use the new package whenever possible.

The new logic can be disable by setting the SHOPWARE_CLI_NO_SYMFONY_CLI environment variable to 1.

While it would also have been possible to directly import the logic from the symfony-cli repository (which is also written in Go), doing so would be more work as the logic is not in one place and it may end up introducing incompatibilities between the two implementations.

Also unlike the actual CLI interface (symfony php, etc.) the actual source packages are not guaranteed to be stable.

@shyim shyim merged commit d96066e into FriendsOfShopware:main Feb 19, 2024
8 checks passed
@nussjustin-hmmh nussjustin-hmmh deleted the exec-php-via-symfony-cli branch March 6, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants