Install missing extensions for PHP 7.4 managed by Laravel Herd

It's not that simple sometimes to manage separate PHP versions and Herd is very handy abstracting all the things so we can start working asap.

However, Herd doesn't include all extensions by default, and some of them are rarely used. It can get tricky when you need particular extension for particular PHP version.

When running herd composer install I've encountered the following error:

Problem 1
- gengo/gengo is locked to version 3.2.1 and an update of this package was not requested.
- gengo/gengo 3.2.1 requires ext-gettext * -> it is missing from your system. Install or enable PHP's gettext extension.
Problem 1
- gengo/gengo is locked to version 3.2.1 and an update of this package was not requested.
- gengo/gengo 3.2.1 requires ext-gettext * -> it is missing from your system. Install or enable PHP's gettext extension.

This can be solved by installing particular extension using MacPorts project.

First download and install MacPorts project.

Then run sudo port install php74-gettext command.

And finally load the extension by adding it into PHP 7.4 php.ini configuration.

echo 'extension=/opt/local/lib/php74/extensions/no-debug-non-zts-20190902/gettext.so' >> /Users/lun/Library/Application\ Support/Herd/config/php/74/php.ini
echo 'extension=/opt/local/lib/php74/extensions/no-debug-non-zts-20190902/gettext.so' >> /Users/lun/Library/Application\ Support/Herd/config/php/74/php.ini

Re-run herd composer install and it should work now.