From dave-liddament
Set up Docker for a PHP CLI project with Xdebug support. Use when the user wants to add Docker to a PHP project.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dave-liddament:docker-php-cliThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Set up Docker for a PHP CLI project.
Set up Docker for a PHP CLI project.
IMPORTANT: This skill works on both new and existing projects. Before each step, check what already exists and only add what is missing.
Use the following priority to determine the PHP version:
$ARGUMENTS is provided (e.g. 8.3), use that version.composer.json for the PHP version requirement.8.5.Create a Dockerfile in the project root if one doesn't already exist.
Use the template from ${CLAUDE_SKILL_DIR}/Dockerfile.template as a base. Adjust the PHP version as determined in Step 1.
If a Dockerfile already exists, leave it as-is.
Create a docker-compose.yml in the project root if one doesn't already exist.
Use the template from ${CLAUDE_SKILL_DIR}/docker-compose.yml.template as a base. Adjust the PHP version to match the Dockerfile.
If a docker-compose.yml already exists, leave it as-is.
Ensure .gitignore does NOT ignore Docker files — Dockerfile and docker-compose.yml should be committed.
Add a note to the project's CLAUDE.md file (create it if it doesn't exist). Merge with existing content if present.
Add the following guidance:
## Docker
This project uses Docker for all PHP operations. Always use `docker compose exec app` to run PHP commands inside the container.
Examples:
- `docker compose exec app composer install`
- `docker compose exec app vendor/bin/phpunit`
- `docker compose exec app vendor/bin/phpstan analyse`
To start the container: `docker compose up -d`
To stop the container: `docker compose down`
To rebuild after Dockerfile changes: `docker compose up -d --build`
Xdebug is enabled by default. To disable it, set `XDEBUG_MODE=off` in `docker-compose.yml` and restart the container.
Build and start the container:
docker compose up -d --build
Verify the container is running:
docker compose ps
npx claudepluginhub daveliddament/php-claude-skills --plugin dave-liddamentGenerates Dockerfile.dev and docker-compose.dev.yml for PHP projects with Xdebug, hot reload via volumes/OPcache, and tools like Composer/git/vim. Analyzes composer.json for versions/frameworks.
Generates Dockerfile, docker-compose.yaml, .dockerignore, and .env.example for Dockerizing Node.js, Python, PHP/Laravel, Go projects. Use for new setups, migrations, or adding Docker support.
Build production-ready Dockerfiles with multi-stage builds, security hardening, and docker-compose for local dev. Use when asked to "create Dockerfile", "optimize container", or "dockerize this".