[Feature Request]: Install PHP CLI binaries in versioned folders to support PATH manipulation for isolated sites #380
Replies: 8 comments
-
Note: I'm not precious about that exact file structure that I proposed - I'm actually not a fan of that specific solution. The important thing is that there should be version-specific folders with a |
Beta Was this translation helpful? Give feedback.
-
I'm in the exact same situation. I maintain projects ranging from 7.4 to 8.2. I really like using Herd, but it get's a bit tiring having to manually switch the default PHP version when using the CLI for updating dependencies etc. It would be amazing if the Herd PHP binary was able to automatically switch to the correct PHP version per site, respecting the version that's selected in the UI for the CLI as well. |
Beta Was this translation helpful? Give feedback.
-
You don't have to switch the default php version. If the site is isolated you can use "herd php" to redirect calls to the correct php version. |
Beta Was this translation helpful? Give feedback.
-
Hey @mpociot Thanks for the reply. Neither Creating a folder-per-version with a |
Beta Was this translation helpful? Give feedback.
-
@thomas-alrek I think having herd handle the switching is a bit beyond its scope (after all there are a myriad of terminals & shells out there). It's certainly beyond the scope of what I was asking for here. |
Beta Was this translation helpful? Give feedback.
-
Yeah probably. But since Herd already provide a PHP proxy binary that redirects to the correct version based on your preferences, I feel like it could be in scope. It shouldn't be too hard to implement in theory. Would be very convenient |
Beta Was this translation helpful? Give feedback.
-
@thomas-alrek It should maybe a separate issue then, because it's different for what this is asking for. |
Beta Was this translation helpful? Give feedback.
-
We deal with this issue as well. Currently I am using Valet with autoenv to accomplish the correct php version for isolated sites. In the mean time will autoenv work with Herd if we were to make the switch? We are intrigued by what the Pro version of Herd offers. |
Beta Was this translation helpful? Give feedback.
-
Feature Description
On my development box I have a number of different projects that have different PHP requirements. Herd's isolation functionality neatly handles making sure that sites are served with the correct version, but it's difficult to ensure that the right PHP CLI binary is invoked for a project.
Under valet/homebrew I handled this with an autoenv script which prepended the version specific PHP folder to the PATH. Since homebrew installs the binaries in versioned folders, this worked nicely. E.g. the following autoenv script ensures that when I'm in that project folder, my PATH will cause php 8.0 binary to be used for CLI commands.
Most important about this solution is that it's local to that shell - ie I can have two terminals open in two different projects, and each will invoke the correct PHP binary.
I'm aware of
herd use
, but that doesn't really help since that's global.It would be nice if herd created versioned folders within
/Users/lee/Library/Application\ Support/Herd/bin/
so that this use-case could be supported. The naming isn't ideal, but here's an example structure that would work:With a structure like this, each project folder can have its PATH linked to a version-specific folder, and hence invoke the correct PHP version.
Is this feature valuable for other users as well and why?
Supports anyone working on multiple projects each with differing PHP requirements.
Beta Was this translation helpful? Give feedback.
All reactions