PHP CLI Docker image for Symfony development. Published for PHP 8.3, 8.4 and 8.5, on linux/arm64 and linux/amd64 (Docker pulls only the platform matching your machine).
# Latest stable (PHP 8.5)
docker pull ghcr.io/brei0x/php-cli-workspace:latest
# Pin a specific PHP version
docker pull ghcr.io/brei0x/php-cli-workspace:8.3
# Interactive shell
docker run --rm -it ghcr.io/brei0x/php-cli-workspace
# Mount a project
docker run --rm -it -v $(pwd):/app ghcr.io/brei0x/php-cli-workspace php bin/console list- PHP 8.3, 8.4 or 8.5 (Debian Trixie)
- Composer 2
- Xdebug 3 (mode
offby default) - Extensions:
bcmathbz2curlexiffileinfogdintlmbstringopcacheopensslpcntlpdo_mysqlpdo_pgsqlpgsqlsodiumsocketsxslzip
Xdebug is installed but disabled by default to avoid overhead. Enable it at runtime via the XDEBUG_MODE environment variable:
# Step debugging (PHPStorm / any DAP client)
docker run --rm -it -e XDEBUG_MODE=debug -v $(pwd):/app ghcr.io/brei0x/php-cli-workspace php bin/console …
# Profiling
docker run --rm -it -e XDEBUG_MODE=profile -v $(pwd):/app ghcr.io/brei0x/php-cli-workspace php …Default settings: client_host=host.docker.internal, client_port=9003, idekey=PHPSTORM.
Both IDEs share the same PHP plugin, so the setup is identical.
-
Interpreter: Settings → PHP → CLI Interpreter → … → + → From Docker, image
ghcr.io/brei0x/php-cli-workspace:latest. Keep the default container volume (project root →/opt/project). Optional configuration options:-dmemory_limit=512M. -
Composer: Settings → PHP → Composer → Execution: Remote Interpreter. Then use Tools → Composer → Install, or the links above
composer.json. -
Commands: Settings → Tools → PHP Command Line Tool Support → +, remote interpreter:
Tool Path Alias Symfony /opt/project/bin/consolesComposer (composer.phar or php script) /usr/local/bin/composercRun them from Tools → Run Command… (
Ctrl+Shift+X):s about,c -d /opt/project install,c -d /opt/project require symfony/mailer --dev.Process finished with exit code 0means success. The IDE runs a tool from its script's directory, socstarts in/usr/local/bin:-d /opt/projectpoints Composer at the project, or use step 2 instead. -
Debugging: in a run/debug configuration, set
XDEBUG_MODE=debugand start listening on port 9003 (default).
Notes:
- Use a real Xdebug mode (
debug,profile…), neveron: PHP reads it as1, which Xdebug rejects. bin/console aboutshowsXdebug trueas soon as the extension is loaded, even with modeoff.- Each command runs in a fresh container: add
--network <name>to the interpreter's Docker container options to reach a database or other services. - The IDE's built-in Terminal runs on your machine, not in the container: aliases
sandcdo not exist there.
If you already have the image pulled, re-pull to get the latest version (Docker only downloads changed layers):
docker pull ghcr.io/brei0x/php-cli-workspace:latestTo verify the image date after pulling:
docker inspect ghcr.io/brei0x/php-cli-workspace:latest --format '{{.Created}}'| Tag | PHP |
|---|---|
latest |
8.5 |
8.5 |
8.5 |
8.4 |
8.4 |
8.3 |
8.3 |
Each tag covers linux/arm64 and linux/amd64. To pull the other platform (for example an amd64 image on Apple Silicon, run under emulation):
docker pull --platform linux/amd64 ghcr.io/brei0x/php-cli-workspace:latestThe Dockerfile itself is versioned by git tags (vX.Y.Z) and GitHub releases, cut from the Conventional Commits of each push to main. Image tags stay by PHP version, and every tag is rebuilt each Monday to pick up PHP and Debian security patches.
# Default (PHP 8.5)
docker build -t php-cli-workspace .
# A specific version
docker build --build-arg PHP_VERSION=8.3 -t php-cli-workspace:8.3 .MIT. The image also ships PHP, Debian packages and Composer under their own licenses.