docker-php-extension-installer is a shell script that automates PHP extension installation in official PHP Docker images.
The tool solves the problem of manually managing dependencies when installing PHP extensions in Docker containers. It handles the installation of required system packages via APT or APK, then removes unnecessary packages afterward to keep the final image size small. The script supports Debian-based images from Debian 8 onward and Alpine-based images from Alpine 3.9 onward, covering PHP versions from 5.5 to current releases.
Developers should use this tool when building Docker images that require specific PHP extensions. It suits any project that needs a streamlined, reproducible way to add extensions without manually tracking system dependencies. The script offers multiple integration methods: downloading on the fly with ADD or curl, copying from a pre-built Docker image, or using the script directly from a published image. It supports installing specific extension versions, including compatible versions via caret syntax and pre-release versions from PECL with state suffixes like alpha, beta, or rc. Extensions can also be installed from source code when a package.xml or package2.xml file is available.
The project maintains active engagement with Docker image updates and dependency management. It regularly updates to support new PHP versions and extension releases. The tool receives consistent refinement in how it handles edge cases across different base images and PHP versions. Community contributions are incorporated for expanding extension support and improving installation reliability across the range of supported platforms.