How to install and enable ext-http for php8.1 in Laravel Herd on Mac Sonoma

October 28, 2024
Zacharias Creutznacher
Zacharias Creutznacher
Chief Technology Officer (CTO)

Laravel Herd comes with a bunch of default extensions enabled. But if you need ext-http you'll find out that it's not enabled by default. Here is small guide how you can install and enable it. I tested it on a Mac Sonoma. First of all make sure, to read the section in the docs where they explain how to enable and load new extensions into herd: Installing PHP Extensions. Now you understand that you need homebrew to install these extensions, which you then kinda hook into your Laravel Herds php.ini config.

Install ext-http via PECL

You can install the php http extension with pecl:

pecl install pecl_http

But they now gonna ask you for a lot of lib paths and maybe some of those libs are not yet installed on your machine.

For me the following worked:

brew install curl zlib libidn libidn2

Now you can provide the following paths during the installation:

...
...
./autoconf/pecl/pecl.m4:362: PECL_CHECK_DONE is expanded from...
config9.m4:171: the top level
where to find zlib [/usr] : /opt/homebrew/opt/zlib
where to find libcurl [/usr] : /opt/homebrew/opt/curl
where to find libevent [/usr] : /opt/homebrew/opt/libevent
where to find libicu [/usr] : /opt/homebrew/opt/icu4c
where to find libidn2 [/usr] : /opt/homebrew/opt/libidn2
where to find libidn [/usr] : /opt/homebrew/opt/libidn
where to find libidnkit2 [/usr] :/opt/homebrew/opt/libidn2
where to find libidnkit [/usr] /opt/homebrew/opt/libidn

As libidnkit seems to be deprecated on my Mac version, I was just able to put libidn in the path.

Enable the extensions

Installing pecl also automatically installs raphf.

We need to add these paths to the herd php.ini file (you can open the config files in the Laravel Herd menu bar icon dropdown).

# make sure that the number matches your php version here!
extension=/opt/homebrew/lib/php/pecl/20210902/raphf.so
extension=/opt/homebrew/lib/php/pecl/20210902/http.so

Now restart herd and you're done!

code

What’s a Rich Text element?

The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.

Static and dynamic content editing

A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!

How to customize formatting for each rich text

Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.

H4

H5
H6

http://google.de

<code>test123<code>

<span style="color:red;">asdfasdf</span>

composer require spatie/laravel-artisan-dispatchable

Setzen Sie Ihre Ideen um!
Heute ist der Tag, um das Geschäft Ihrer Träume aufzubauen. Teilen Sie Ihre Mission mit der Welt – und begeistern Sie Ihre Kunden.
Jetzt starten