PHP Extensions
php-ci enables the extensions a typical PHP test run needs — database drivers, string/intl handling and image processing — so you rarely need to install anything yourself.
Enabled extensions
| Extension | Why it's included |
|---|---|
mbstring | Multibyte string handling (near-universal requirement) |
intl | Internationalisation; required by many frameworks |
pdo_mysql | MySQL / MariaDB connectivity |
pdo_pgsql | PostgreSQL connectivity |
pdo_sqlite / sqlite3 | Zero-infrastructure test databases |
gd | Image processing (with freetype, jpeg, png, webp) |
zip | Archive handling; speeds up composer --prefer-dist |
bcmath | Arbitrary-precision math |
xml / dom / simplexml | XML processing & PHPUnit output |
curl | HTTP clients |
opcache | Bytecode caching |
json | JSON (built in on modern PHP) |
pcntl / posix | Process control for long-running test tooling |
sodium | Modern cryptography |
| Coverage driver | Code-coverage collection |
TYPO3 variant
TYPO3 functional tests can run against SQLite via pdo_sqlite (no database
service required). See TYPO3 for examples.
List loaded extensions
docker run --rm himanshuramavat/php-ci:8.3 php -m
Check for a specific extension:
docker run --rm himanshuramavat/php-ci:8.3 php -m | grep -i intl
Inspect an extension's configuration:
docker run --rm himanshuramavat/php-ci:8.3 php --ri opcache
Adding an extension
If your project needs an extension that isn't enabled, extend the image:
FROM himanshuramavat/php-ci:8.3
RUN apt-get update \
&& apt-get install -y --no-install-recommends libldap2-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install ldap
For PECL extensions:
FROM himanshuramavat/php-ci:8.3
RUN pecl install redis \
&& docker-php-ext-enable redis
If you find yourself adding the same extension across multiple projects, consider opening an issue to propose it for the base image.