Skip to content

Skillshare/asdf-brew-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asdf-brew-php Build Lint

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.

Contents

Dependencies

  • brew

Install

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.

Contributing

Contributions of any kind welcome! See the contributing guide.

Thanks goes to these contributors!

How to list versions

bin/list-all

How to install a version

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

License

See LICENSE © Skillshare Inc.

FAQ

How does this work?

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.

What versions are supported?

8.1, 8.2, 8.3, and 8.4 at the time of this writing.

Why are patch versions not supported?

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.

What are the trade-offs with this approach?

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.

Are there other limitations?

  • Installing "ref" say a path to a brew formula definition or a gitref are not suppored.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages