brew-php plugin for the asdf version manager.
Why this plugin? Compiling PHP is not deterministic on macOS. Relying on existing brew bottles is more deterministic. This plugin trades off compiling an explicit major, minor, and patch level PHP for whatever precompiled major and minor version is available in brew.
brew
Plugin:
asdf plugin add brew-php
# or
asdf plugin add brew-php https://github.com/Skillshare/asdf-brew-php.git
brew-php:
# Show all installable versions
asdf list-all brew-php
# Install specific version
asdf install brew-php latest
# Install a given minor version
asdf install brew-php 8.4
# Set a version globally (on your ~/.tool-versions file)
asdf global brew-php latest
# Now brew-php commands are available
php --version
Check asdf readme for more instructions on how to install & manage versions.
Contributions of any kind welcome! See the contributing guide.
Thanks goes to these contributors!
bin/list-all
You can run the plugin scripts independent of asdf
. asdf
calls the
script with the expected environment variables. See the
docs.
$ env ASDF_INSTALL_TYPE=version ASDF_INSTALL_VERSION=8.4 ASDF_INSTALL_PATH=tmp/8.4 bin/install
$ tmp/8.4/bin/php --version
See LICENSE © Skillshare Inc.
The plugin relies on versioned formulae ([email protected]
, [email protected]
etc) in
brew. The formulas come "bottled", meaning they are precompiled for
specific macOS versions. The pluging installs a brew formula then
links it to asdf install directory.
8.1, 8.2, 8.3, and 8.4 at the time of this writing.
The plugin relies on Brew formulae. Those are only pinned to minor versions. So you can only install a minor version. The current formula determines the patch version.
The obvious trade-off is patch level version management. Relying on
brew also means the patch level may change when running brew upgrade
or brew update
. So for example, say .tool-versions
contains
brew-php 8.4
. asdf install
would install the [email protected]
formula.
The formula may be set to use 8.4.1
. A future brew update
could
update [email protected]
to 8.4.5
. Now that brew-php 8.4
would use
8.4.5
.
- Installing "ref" say a path to a brew formula definition or a gitref are not suppored.