From 95880704a4a3604ab7c93db21377ee864db2d058 Mon Sep 17 00:00:00 2001 From: Tugdual Saunier Date: Sat, 29 Nov 2025 15:26:28 +0100 Subject: [PATCH] Add support for custom lookup path using the `SYMFONY_CLI_PHP_PATH` environment varialbe --- discovery.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/discovery.go b/discovery.go index 95e0d04..6e9d8aa 100644 --- a/discovery.go +++ b/discovery.go @@ -323,6 +323,7 @@ func normalizeVersion(v string) string { func (s *PHPStore) pathDirectories(configDir string) []string { phpShimDir := filepath.Join(configDir, "bin") + additionalPath := os.Getenv("SYMFONY_CLI_PHP_PATH") path := os.Getenv("PATH") if runtime.GOOS == "windows" { path = os.Getenv("Path") @@ -330,7 +331,7 @@ func (s *PHPStore) pathDirectories(configDir string) []string { user := os.Getenv("USERPROFILE") dirs := []string{} seen := make(map[string]bool) - for _, dir := range filepath.SplitList(path) { + for _, dir := range filepath.SplitList(additionalPath + string(filepath.ListSeparator) + path) { dir = strings.Replace(dir, "%%USERPROFILE%%", user, 1) edir, err := evalSymlinks(dir) if err != nil {