This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
PHPDocker.io is a Symfony 7 web application that generates Docker environments for PHP projects. Users fill out a form and receive a zip archive containing docker-compose.yaml, Dockerfile, nginx config, PHP ini, and a README.
Tech stack: PHP 8.4, Symfony 7.0, Twig, Redis (cache/sessions), Docker Compose (local), Kubernetes (production).
All commands run via Docker containers. Use make targets rather than running PHP/vendor binaries directly on the host.
make init # Full first-time setup (certs, hosts, deps, Docker build, start)
make start # Start containers
make stop # Stop containers
make shell # Bash shell inside PHP container
make static-analysis # PHPStan level 9 on src/
make unit-tests # PHPUnit (no coverage)
make coverage-tests # PHPUnit with xdebug coverage
make behaviour # Behat behavioral tests
make clear-cache # Clear Symfony var/ cache
make fix-cache-permissions-dev # Fix var/ permissions if neededRunning a single test file:
docker compose run -e XDEBUG_MODE=coverage --rm php-fpm vendor/bin/phpunit tests/Functional/GeneratorTest.phpRunning a single Behat scenario:
docker compose run -e XDEBUG_MODE=coverage --rm php-fpm vendor/bin/behat --colors --name="scenario name"The app runs at https://phpdocker.local:10000 after make init.
- User submits the form at
/(handled byGeneratorController) ProjectType(Symfony Form) deserializes request into aProjectmodel with nested service option objects (MySQLOptions,PostgresOptions, etc.)Generatororchestrates file generation, delegating to individual file generators:Dockerfile.php,DockerCompose.php,NginxConf.php,PhpIni.php,Readme.php
Archiverbundles the generated files into a zip and streams it to the browser
App\PHPDocker\Generator\— Core generation engine (file generators + orchestrator)App\PHPDocker\Project\ServiceOptions\— Service configuration models (MySQL, Postgres, Redis, etc.)App\PHPDocker\PhpExtension\— PHP extension metadata per version (8.2–8.5)App\Form\Generator\— Symfony Form types mirroring the domain modelsApp\Controller\— SingleGeneratorController
tests/Unit/— Unit tests for isolated classestests/Functional/— Symfony WebTestCase functional tests (GeneratorTest.phpis the main one)tests/Behat/+features/— Behavioral tests via Behat/Mink with Symfony driver
When adding generator features, update tests/Functional/GeneratorTest.php and features/generator.feature.
declare(strict_types=1)in every PHP file- PHPStan level 9 — all changes must pass with zero errors
- PSR-12 + Symfony best practices
- Constructor property promotion with
readonlywhere applicable
Container images are built via make build-and-push and deployed to Kubernetes via make deploy:
- PHP-FPM image:
phpdockerio/site-php - Nginx image:
phpdockerio/site-ngx - Kubernetes manifests:
infrastructure/kubernetes/