phpro/grumphp

Composer plugin tasks not executed using the PHP version Composer is invoked with

Closed

#1170 opened on Apr 11, 2025

View on GitHub
 (4 comments) (0 reactions) (0 assignees)PHP (4,040 stars) (473 forks)batch import
enhancementhelp wanted

Description

Given:

  • two PHP versions installed side by side - 8.2 and 8.3
  • /usr/bin/php invokes PHP 8.2 (managed via alternatives), so that's the default version
  • Composer is explicitly invoked with PHP 8.3, i.e. /usr/bin/php8.3 ./composer.phar install

In this setup GrumPHP git:init and configure scripts are executed using PHP 8.2 because the plugin calls vendor/bin/grumphp directly instead of using the PHP binary Composer is using for the current invocation.

I'm not familiar with Composer Plugin API enough to tell if Composer exposes internally the PHP binary it was invoked with. However it looks like there is @php syntax for scripts that does something similar to what ${MAKE} would do in a Makefile, so Composer must maintain some sort of reference to the current PHP binary.

Contributor guide