Skip to content
phpyhPublic

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

100 Commits

Folders and files

Repository files navigation

PHPyh development PHP images

Build

PHP Docker images for development and CI, built on top of php:<version>-cli-alpine.

Images

Published to ghcr.io/phpyh/php for linux/amd64 and linux/arm64 on every push to main and every Monday, so PHP patch releases, extensions and tools stay up to date.

Tag PHP
ghcr.io/phpyh/php:8.2 8.2 (no updates after security EOL on 31 Dec 2026)
ghcr.io/phpyh/php:8.3 8.3
ghcr.io/phpyh/php:8.4 8.4
ghcr.io/phpyh/php:8.5 8.5
ghcr.io/phpyh/php:8.6 8.6 (RC until GA release)

Each image is also tagged with the full PHP version, e.g. ghcr.io/phpyh/php:8.5.12. Both tags are moving: they are rebuilt weekly with the latest extensions and tools. For a reproducible environment, pin the image by digest:

image: ghcr.io/phpyh/php:8.5@sha256:<digest>

Get the current digest with docker buildx imagetools inspect ghcr.io/phpyh/php:8.5.

Notable changes, including breaking ones, are listed in CHANGELOG.md.

Usage

# compose.yaml
services:
  app:
    image: ghcr.io/phpyh/php:8.5
    volumes:
      - .:/app
      - composer-cache:/composer/cache
    working_dir: /app

volumes:
  composer-cache:

Or as a one-off command:

docker run --rm -it -v "$PWD:/app" -w /app ghcr.io/phpyh/php:8.5 composer install

File permissions

The container runs as dev with UID 1000, the UID of the first user on most Linux systems. On Linux, bind-mounted files keep their numeric owner, so if your UID is different (id -u), the container can't write to your project. Run it as your host user then: user: <uid>:<gid> in Compose or -u "$(id -u):$(id -g)" with docker run. Composer home, Composer cache and the Xdebug log are writable by any user. Such a user has no /etc/passwd entry, so HOME is / and git config --global is not available.

On macOS and Windows, Docker Desktop remembers the owner of files created in the container, and a container running with another UID can't modify them. Always run the container with the same UID.

Composer cache

Mount a named volume to /composer/cache to keep the cache between runs, as in the example above. To bind-mount a host directory instead, create it first, otherwise Docker creates it owned by root.

What's included

PHP configuration

Drop any .ini file into /usr/local/etc/php/conf.d/ — PHP picks it up automatically.

Via a volume mount:

services:
  app:
    image: ghcr.io/phpyh/php:8.5
    volumes:
      - ./php.ini:/usr/local/etc/php/conf.d/99-local.ini

Or by extending the image:

FROM ghcr.io/phpyh/php:8.5
COPY php.ini /usr/local/etc/php/conf.d/99-local.ini

Xdebug

Xdebug is installed, but disabled by default (xdebug.mode=off), so it doesn't slow PHP down. Enable it for a single run with the XDEBUG_MODE environment variable:

# Code coverage
docker compose run --rm -e XDEBUG_MODE=coverage app vendor/bin/phpunit --coverage-html=var/coverage

# Step debugging of a CLI script
docker compose run --rm -e XDEBUG_MODE=debug -e XDEBUG_TRIGGER=1 app php script.php

Step debugging in PhpStorm

Add to the service from Usage:

# compose.yaml
services:
  app:
    environment:
      # Must match the server name in PhpStorm (Settings → PHP → Servers) with path mappings for /app
      PHP_IDE_CONFIG: serverName=app
    extra_hosts:
      # Required on Linux only: Docker Desktop resolves host.docker.internal on its own
      - host.docker.internal:host-gateway

Xdebug connects to host.docker.internal:9003. If the IDE doesn't receive a connection, check /xdebug.log in the container.

License

MIT License — see LICENSE for details.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages