Skip to content

Commit b5f0237

Browse files
committed
feature #34 Add support for custom lookup path using SYMFONY_CLI_PHP_PATH (tucksaun)
This PR was merged into the main branch. Discussion ---------- Add support for custom lookup path using `SYMFONY_CLI_PHP_PATH` There's always a moment when we don't support a specific setup method or someone who will need to be able to use a setup somewhere specific. So what about letting anyone specify a list of directories where to look for PHP installations? Commits ------- 9588070 Add support for custom lookup path using the `SYMFONY_CLI_PHP_PATH` environment varialbe
2 parents 25c6dba + 9588070 commit b5f0237

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

discovery.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,15 @@ func normalizeVersion(v string) string {
323323

324324
func (s *PHPStore) pathDirectories(configDir string) []string {
325325
phpShimDir := filepath.Join(configDir, "bin")
326+
additionalPath := os.Getenv("SYMFONY_CLI_PHP_PATH")
326327
path := os.Getenv("PATH")
327328
if runtime.GOOS == "windows" {
328329
path = os.Getenv("Path")
329330
}
330331
user := os.Getenv("USERPROFILE")
331332
dirs := []string{}
332333
seen := make(map[string]bool)
333-
for _, dir := range filepath.SplitList(path) {
334+
for _, dir := range filepath.SplitList(additionalPath + string(filepath.ListSeparator) + path) {
334335
dir = strings.Replace(dir, "%%USERPROFILE%%", user, 1)
335336
edir, err := evalSymlinks(dir)
336337
if err != nil {

0 commit comments

Comments
 (0)