Laravel Herd

Documentation for macOS

Additional PHP Extensions

#
Installing additional PHP extensions

You may add additional PHP extensions that are not included out of the box with Herd, by installing them via Homebrew and pecl.

#
Adding extensions

Installing additional extensions requires you to install PHP via Homebrew in order to compile them.

You can do this by running:

brew install php

Once PHP is installed via Homebrew, you may install the extension:

pecl install [extension-name]

This creates an [extension].so extension file that you can now activate and use with Laravel Herd.

On an M1/M2 Mac, the extension can be fount at /opt/homebrew/lib/php/pecl. On an Intel Mac, it will be at /usr/local/lib/php/pecl.

#
Activating extensions

You may activate your custom extensions by editing your php.ini file. This file is located at ~/Library/Application Support/Herd/config/php/<version>/php.ini..

# Absolute path to the extension.so file
extension=/opt/homebrew/lib/php/pecl/20220829/[extension].so