pact-foundation/pact-php
PHP implementation of the Pact consumer-driven contract testing framework. Define contracts between services, run provider verification, and integrate with PHPUnit/CI to prevent breaking API changes. Supports HTTP interactions, mock servers, and Pact Broker workflows.
This page explains how to fix a common issue when running Pact PHP v10 on Alpine Linux (musl).
When running Pact on Alpine, you may see:
error while loading shared libraries: libgcc_s.so.1: cannot open shared object file
This happens because Alpine images are minimal:
libgcc) aren’t installed.php:8.3-cli-alpine)Add this to your Dockerfile:
FROM php:8.3-cli-alpine
RUN set -eux; \
apk add --no-cache $PHPIZE_DEPS libgcc; \
docker-php-ext-install ffi; \
echo "ffi.enable=true" > /usr/local/etc/php/conf.d/ffi-enable.ini
php: image)apk add --no-cache php83-ffi
echo "ffi.enable=true" > /etc/php83/conf.d/ffi-enable.ini
php:8.3-cli)FROM php:8.3-cli
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends libgcc-12-dev; \
docker-php-ext-install ffi; \
rm -rf /var/lib/apt/lists/*; \
echo "ffi.enable=true" > /usr/local/etc/php/conf.d/ffi-enable.ini
ffi.enable=true).libgcc and FFI enabled.arm64 images; Pact will load the correct native library automatically.How can I help you explore Laravel packages today?