9

Homebrew has in-house PHP formulae for all PHP versions.

brew install php
brew install [email protected]
...

But there's also a tap (shivammathur/homebrew-php) available to install PHP versions.

brew tap shivammathur/php
brew install shivammathur/php/php
brew install shivammathur/php/[email protected]
...

I've encountered a blog stating the following:

You can either use the built-in php recipe, but I recommend to use the shivammathur/homebrew-php tap.

This makes me wonder what the reasoning is behind the existence of shivammathur/homebrew-php and moreover why it's supposedly recommended over the in-house formulae?

1 Answer 1

16

PHP versions provided by shivammathur/homebrew-php: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3

PHP versions provided by homebrew/homebrew-core: 7.4, 8.0, 8.1, 8.2

Note that the official homebrew/homebrew-core tap does not have the pre-release 8.3 version and the older 5.6, 7.0, 7.1, 7.2 and 7.3 versions. Therefore, it's not recommended to depend on homebrew/homebrew-core for specific PHP versions because they might be unavailable at the moment or deleted in the future. For such cases, a third-party tap such as shivammathur/homebrew-php should be used instead. (Ideally, developers should update their applications to be compatible with the latest stable PHP version, but sometimes that takes too long or is maybe even impossible.)

From Why is it so hard to install old versions of homebrew-core packages?

The philosophy of Homebrew is that we do not care that much about old versions of software. This is how Homebrew was designed, and how it has worked for the last 10 years.

Some people confuse Homebrew with virtualenvs / conda / nix, which surely provide a better support for older versions and different build environments. We are not doing this and do not plan to do this in a foreseable future. Our audience is also not the same.

But support for old versions is not totally zero in Homebrew: you can host an old formula in a tap if you want to maintain it, or we have some versioned formuale (example [email protected] and [email protected]), because we thought these were really important and deserved to be maintained by us. But we try to avoid too many of these and there are strict rules around versioned formulae.

So it is totally doable to build your own collection of homebrew formulae for your company. We even introduced the possibility to build bottles and host them yourself (for free) a few days/weeks ago: https://brew.sh/2020/11/18/homebrew-tap-with-bottles-uploaded-to-github-releases/.

From Acceptable Formulae ¶ Niche (or self-submitted) stuff:

The software in question must:

  • be maintained (i.e. the last release wasn’t ages ago, it works without patching on all Homebrew-supported OS versions and has no outstanding, unpatched security vulnerabilities)
  • be known
  • be stable (e.g. not declared “unstable” or “beta” by upstream)
  • be used
  • have a homepage

We will reject formulae that seem too obscure, partly because they won’t get maintained and partly because we have to draw the line somewhere.

2
  • So, if one plans to stay on par with officially supported PHP releases there's no real reason to use the third-party tap? Commented Dec 2, 2021 at 7:19
  • 9
    I created shivammathur/php tap to provide the PHP versions which are not on homebrew/core with security patches backported. For completeness the tap also has PHP versions which are there on homebrew/core. You are free to use the core tap or my tap. For the common versions, both have the same code and are built similarly, so there is no technical difference. Commented Dec 2, 2021 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.