A collection of PHP extensions bundled as super lightweight Docker images that make it simple to add & enable extensions in your custom PHP Docker images.
Supported PHP versions: 8.0, 8.1, 8.2
Using an extension in your custom image is a simple process consisting of two steps:
- Copy in all files from the
garbetjie/php
extension image. - Run the setup script that installs any additional packages & performs any additional setup required by the extension.
FROM php:8.0.22-cli-alpine3.15 AS php-80
# Copy in the extensions.
COPY --from=garbetjie/php:8.0-pdo_mysql / /
COPY --from=garbetjie/php:8.0-opcache / /
COPY --from=garbetjie/php:8.0-xdebug / /
# Run the setup script.
RUN wget -O- https://raw.githubusercontent.com/garbetjie/docker-php/main/install-dependencies.sh | sh
FROM php:8.2.1-cli-alpine3.17 AS php-82
COPY --from=garbetjie/php:8.2-mysqli / /
COPY --from=garbetjie/php:8.2-grpc / /
RUN wget -O- https://raw.githubusercontent.com/garbetjie/docker-php/main/install-dependencies.sh | sh
Extension images are tagged based on their short PHP version (8.0
, 8.1
or 8.2
), and the extension name as shown in
the output of php -m
.
For example, the grpc
extension can be fetched from the garbetjie/php:8.2-grpc
image.
The table below shows a support matrix of the available extensions, as well as which platforms & PHP versions they're available for:
extension | Arch: linux/amd64 | Arch: linux/arm64 | PHP 8.0 | PHP 8.1 | PHP 8.2 | PHP 8.3 |
---|---|---|---|---|---|---|
amqp | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
apcu | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
bcmath | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
bz2 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
ds | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
exif | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
gd | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
gettext | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
gmp | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
grpc | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
igbinary | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
imagick | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
imap | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
intl | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
memcached | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
memprof | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
mongodb | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
msgpack | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
newrelic | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
opcache | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
opentelemetry | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
pcntl | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
pdo_mysql | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
pdo_sqlsrv | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
protobuf | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
redis | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
snappy | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
soap | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
sockets | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
sqlsrv | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
ssh2 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
uopz | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
xdebug | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
yaml | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
zip | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |