From 87c0ccaad2927b4c69b45baa0ab9c14e7343e40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20KUBLER?= Date: Thu, 12 Nov 2026 12:28:02 +0100 Subject: [PATCH 1/2] feat(composer): allow specify run order Introduces a new environment variable (`PHP_BUILDPACK_RUN_COMPOSER_FIRST`), which, when set to `true`, makes the buildpack run Composer BEFORE npm. This is useful when running frameworks such as symfony-ux. --- bin/compile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index d9e0388f..ec1b094a 100755 --- a/bin/compile +++ b/bin/compile @@ -495,11 +495,22 @@ if [ -n "$PHP_FPM_INCLUDES" ] ; then done fi -if [ "$PHP_BUILDPACK_NO_NODE" != "true" ] ; then - install_node_deps "$BUILD_DIR" + +# By default, we run npm first, and then Composer. +# If PHP_BUILDPACK_RUN_COMPOSER_FIRST is set to "true", we run Composer first +# and then npm. +if [[ "${PHP_BUILDPACK_RUN_COMPOSER_FIRST:-}" = 'true' ]]; then + install_composer_deps "${BUILD_DIR}" "${CACHE_DIR}" "${ENV_DIR}" +fi + +if [[ "${PHP_BUILDPACK_NO_NODE:-}" != "true" ]] ; then + install_node_deps "${BUILD_DIR}" +fi + +if [[ "${PHP_BUILDPACK_RUN_COMPOSER_FIRST:-}" != 'true' ]]; then + install_composer_deps "${BUILD_DIR}" "${CACHE_DIR}" "${ENV_DIR}" fi -install_composer_deps "${BUILD_DIR}" "${CACHE_DIR}" "${ENV_DIR}" # Detect PHP framework # Set FRAMEWORK if not set in environment by user From 8e518b8c40c8cfd583bab629fbadfddeb2716c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20KUBLER?= Date: Thu, 12 Nov 2026 14:07:20 +0100 Subject: [PATCH 2/2] chore: add comment As suggested by @matthieu526-scalingo in PR review --- bin/compile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/compile b/bin/compile index ec1b094a..a86e865f 100755 --- a/bin/compile +++ b/bin/compile @@ -499,6 +499,8 @@ fi # By default, we run npm first, and then Composer. # If PHP_BUILDPACK_RUN_COMPOSER_FIRST is set to "true", we run Composer first # and then npm. +# This is especially useful for frameworks such a symfony-ux that require +# Composer to run before npm. if [[ "${PHP_BUILDPACK_RUN_COMPOSER_FIRST:-}" = 'true' ]]; then install_composer_deps "${BUILD_DIR}" "${CACHE_DIR}" "${ENV_DIR}" fi