Skip to main content

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

ExtensionWhy it's included
mbstringMultibyte string handling (near-universal requirement)
intlInternationalisation; required by many frameworks
pdo_mysqlMySQL / MariaDB connectivity
pdo_pgsqlPostgreSQL connectivity
pdo_sqlite / sqlite3Zero-infrastructure test databases
gdImage processing (with freetype, jpeg, png, webp)
zipArchive handling; speeds up composer --prefer-dist
bcmathArbitrary-precision math
xml / dom / simplexmlXML processing & PHPUnit output
curlHTTP clients
opcacheBytecode caching
jsonJSON (built in on modern PHP)
pcntl / posixProcess control for long-running test tooling
sodiumModern cryptography
Coverage driverCode-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.