A production-ready Symfony development template with Docker, featuring a clean separation between application code and development tools.
This template provides:
- Clean architecture - Application code (
app/) separated from tooling (tools/) - Docker-first development - All commands run in containers for consistency
- Castor task runner - Modern PHP task runner replacing Makefiles
- QA tools pre-configured - PHPStan, PHP CS Fixer, PHPUnit ready to use
- AI Mate integration - MCP server for AI assistants (Copilot, Claude, Cursor, etc.)
- AI-friendly documentation - See
AGENTS.mdfor coding agent guidelines
symfony-docker/
βββ app/ # π― Symfony application
β βββ src/ # Your application code
β βββ tests/ # Tests (Smoke, Unit, Functional)
β βββ config/ # Symfony configuration
β βββ composer.json # Application dependencies
β
βββ tools/ # π§ Development tools (not deployed)
β βββ castor/ # Castor commands & task definitions
β βββ phpstan.neon # PHPStan configuration
β βββ .php-cs-fixer.php # PHP CS Fixer configuration
β βββ composer.json # QA tools dependencies
β
βββ infrastructure/dev/ # π³ Docker configuration
β βββ network.yml # Docker network definition
β βββ services/ # Service definitions (database, server, proxy)
β βββ configurations/ # Service configs (nginx, php, php-fpm)
β
βββ castor.php # Castor entry point
βββ AGENTS.md # π€ Guidelines for AI coding agents
βββ AI_MATE_SETUP.md # π€ Guidelines for using AI Mate (Symfony debug MCP server)
βββ README.md # π You are here
Key principles:
app/contains only production codetools/contains development/QA tools (excluded from deployment)- QA configurations in
tools/analyzeapp/code - All Docker configs in
infrastructure/
This project uses Castor as task runner.
Installation: https://castor.jolicode.com/installation/
# Generate Docker configurations
castor project:init
# Install dependencies and setup everything
castor install# Start all containers
castor docker:start
# Open a shell in the container
castor bash
# Clear cache
castor cc
# Run quality checks
castor app:qa- Web: http://localhost:8811
- Database: localhost:5422 (credentials in
infrastructure/dev/services/database/.env)
castor docker:start # Start all services
castor docker:start database # Start specific service
castor docker:stop # Stop all services
castor docker:down -v # Stop and remove everything (including volumes)
castor docker:ps # List running containers
castor bash # Open shell in app container
castor bash -p tools # Open shell in tools directorycastor cc # Clear Symfony cache
castor app:phpcs # Fix code style
castor app:phpstan # Run static analysis
castor app:phpunit # Run all tests
castor app:phpunit tests/Unit/ # Run specific test folder
castor app:qa # Run all QA checkscastor database:reload # Rebuild database with fixtures
castor database:reload-tests # Rebuild test database
castor database:migrate # Run migrations
castor database:make-migration # Create new migrationcastor mate:setup # Setup MCP config (run once)
castor mate:serve # Start MCP server
castor mate:tools # List available tools
castor mate:capabilities # Show all capabilities
castor mate:call php-version '{}' # Test a toolQuick setup:
- Run
castor mate:setupto createmcp.jsonwith your project path - Configure your AI assistant to use the MCP server
castor install # Install all dependencies (app + tools)
castor install app # Install only app dependencies
castor install tools # Install only tools dependencies
castor project:init # (Re)initialize Docker configs- PHP: 8.4 (FPM Alpine)
- Symfony: 7.x
- PostgreSQL: 18 Alpine
- Nginx: Alpine 3.18
- Castor: PHP task runner
- PHPStan: Static analysis (level max)
- PHP CS Fixer: Code style fixer (PSR-12)
- PHPUnit: Testing framework
- Docker Compose: Container orchestration
- Symfony AI Mate: MCP server for AI assistant integration
AGENTS.md- Best practices and guidelines for AI coding agentsapp/- Standard Symfony documentation appliestools/castor/- See Castor command definitions for available tasks
Edit values during castor project:init or manually in:
infrastructure/dev/services/proxy/proxy.yml.dist(Nginx port)infrastructure/dev/services/database/database.yml.dist(PostgreSQL port)
Then regenerate: castor project:init
- Create
infrastructure/dev/services/{service}/{service}.yml.dist - Add service to
tools/castor/Enum/Service.php - Update
tools/castor/Commands/Project.phptemplate list - Regenerate:
castor project:init
Create functions in tools/castor/Commands/ with #[AsTask] attribute:
#[AsTask(description: 'Your command description', namespace: 'app')]
function my_command(): void
{
// Your code here
}In the container:
app/(local) β/var/www/project(container)tools/(local) β/var/www/tools(container)
This is why QA tool configs reference /var/www/project paths.
This project includes AGENTS.md with detailed guidelines for AI coding agents.
Β© Edouard Courty - 2023-2026