Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pact Php Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Pact PHP — Alpine (musl) FFI Troubleshooting

This page explains how to fix a common issue when running Pact PHP v10 on Alpine Linux (musl).


The problem

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:

  • Required runtime libraries (like libgcc) aren’t installed.
  • The PHP FFI extension (used by Pact v10) is missing or disabled.

The fixes

1) Official PHP Alpine images (e.g., 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

2) Alpine’s distro PHP (not Docker Hub’s php: image)

apk add --no-cache php83-ffi
echo "ffi.enable=true" > /etc/php83/conf.d/ffi-enable.ini

3) Debian/Ubuntu base images (e.g., 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

Notes

  • Pact PHP v10 requires PHP 8.1+ and the FFI extension enabled (ffi.enable=true).
  • If you use multi-stage Docker builds, make sure the final image still has libgcc and FFI enabled.
  • On Apple Silicon (ARM64), use matching arm64 images; Pact will load the correct native library automatically.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hotmeteor/eco-env
mvaliolahi/hydrate
wearede/tbcpay-php
parsnick/steak
thibaud-dauce/mattermost-php
multilinguals/apollo-client
antaresbr/collection
kr0lik/phpstan-rules
loco/loco
starfederation/datastar-php
yupmin/modern-phystrix
stephenjude/extended-artisan-commands
lumphp/laravel-macroable
lumphp/laravel-collections
lumphp/laravel-contracts
sermepa/sermepa
arkecosystem/fortify
arkecosystem/ui
owowagency/laravel-resources
gtjamesa/php-standards