在Hyperf官方Dockerfile中添加如下描述即可:

1
2
3
4
5
6
# Install Mosquitto Extention
RUN apk add --no-cache php7-dev \
&& apk add --no-cache autoconf gcc g++ make \
&& apk add --no-cache mosquitto-dev \
&& printf "yes\n" | pecl install Mosquitto-alpha \
&& echo "extension=mosquitto.so" > /etc/php7/conf.d/mosquitto.ini

参考:

Mosquitto-PHP文档