Skip to main content

Quick Start

This page gets you from zero to a green test run in about a minute. You only need Docker installed.

1. Pull the image

docker pull himanshuramavat/php-ci:8.3

2. Run your test suite

From the root of any PHP project (one containing a composer.json), mount the working directory into the container and run Composer + PHPUnit:

docker run --rm -v "$(pwd):/app" -w /app himanshuramavat/php-ci:8.3 \
bash -c "composer install --no-interaction --prefer-dist && ./vendor/bin/phpunit"

What each flag does:

  • --rm — remove the container when the command exits.
  • -v "$(pwd):/app" — mount your current directory at /app inside the container.
  • -w /app — set /app as the working directory.

3. Drop into an interactive shell (optional)

Useful for debugging a failing pipeline locally:

docker run --rm -it -v "$(pwd):/app" -w /app himanshuramavat/php-ci:8.3 bash

Inside the container you have the full toolchain on PATH:

php --version
composer --version
./vendor/bin/phpunit --version

4. Minimal composer.json

If you are starting fresh, this is enough to exercise the image:

{
"name": "acme/example",
"require-dev": {
"phpunit/phpunit": "^11.0"
},
"autoload": {
"psr-4": {"Acme\\": "src/"}
},
"autoload-dev": {
"psr-4": {"Acme\\Tests\\": "tests/"}
},
"scripts": {
"test": "phpunit",
"ci": ["@test"]
}
}

With a scripts block defined, your CI command collapses to a single, portable line:

docker run --rm -v "$(pwd):/app" -w /app himanshuramavat/php-ci:8.3 \
bash -c "composer install --no-interaction && composer ci"

Next steps