Development Setup
Complete guide for setting up the development environment with Docker and Task.
Prerequisites
Section titled “Prerequisites”Before you start, make sure you have:
- Docker & Docker Compose - For running containers
- Task - Modern task runner (optional but recommended)
- Git - Version control
- PHP 8.2+ - If running without Docker
Quick Start
Section titled “Quick Start”1. Clone the Repository
Section titled “1. Clone the Repository”git clone git@github.com:event4u-app/data-helpers.gitcd data-helpers2. Install Task (Optional but Recommended)
Section titled “2. Install Task (Optional but Recommended)”macOS:
brew install go-task/tap/go-taskLinux:
snap install task --classicWindows:
choco install go-taskSee official installation guide for other methods.
3. Start Development Environment
Section titled “3. Start Development Environment”# With Task (recommended)task dev:setup
# Or manuallydocker-compose up -d --builddocker exec -it data-helpers-php84 composer install4. Verify Installation
Section titled “4. Verify Installation”# Run teststask test:run
# Or manuallydocker exec -it data-helpers-php84 vendor/bin/pestDocker Setup
Section titled “Docker Setup”Available Containers
Section titled “Available Containers”The project provides three PHP containers:
- data-helpers-php82 - PHP 8.2 with Composer & Task
- data-helpers-php83 - PHP 8.3 with Composer & Task
- data-helpers-php84 - PHP 8.4 with Composer & Task (default)
Docker Commands
Section titled “Docker Commands”# Start containerstask docker:up
# Stop containerstask docker:down
# Restart containerstask docker:restart
# View logstask docker:logs
# Clean up (remove containers & volumes)task docker:clean
# Rebuild everythingtask docker:rebuildShell Access
Section titled “Shell Access”# Open shell in PHP 8.4 (default)task shell
# Open shell in specific PHP versiontask shell PHP=8.2task shell:82task shell:83task shell:84Task Runner
Section titled “Task Runner”Task is a modern alternative to Make with YAML syntax and better readability.
Why Task?
Section titled “Why Task?”- ✅ Cross-platform - Works on macOS, Linux, and Windows
- ✅ Fast - Written in Go, much faster than Make
- ✅ Simple - YAML-based configuration
- ✅ Powerful - Variables, dependencies, includes
- ✅ Beautiful Output - Consistent formatting with colors and icons
Task Structure
Section titled “Task Structure”Taskfile.yml # Main file with aliasestaskfiles/├── docker.yml # Docker container management├── tests.yml # All testing operations├── quality.yml # Code quality checks├── dev.yml # Development workflows├── bench.yml # Performance benchmarking└── docs.yml # Documentation (Starlight)Available Task Categories
Section titled “Available Task Categories”🐳 Docker Management
Section titled “🐳 Docker Management”task docker:build # Build containerstask docker:up # Start containerstask docker:down # Stop containerstask docker:restart # Restart containerstask docker:logs # Show logstask docker:logs:follow # Follow logstask docker:clean # Remove containers & volumestask docker:rebuild # Rebuild everything📦 Dependencies
Section titled “📦 Dependencies”task install # Install dependencies (all containers)task install:82 # Install in PHP 8.2task install:83 # Install in PHP 8.3task install:84 # Install in PHP 8.4task update # Update dependencies (PHP 8.4)task update PHP=8.2 # Update in PHP 8.2🧪 Testing
Section titled “🧪 Testing”# Basic teststask test:run # Run tests (PHP 8.4)task test:run PHP=8.2 # Run tests (PHP 8.2)task test:unit # Unit tests onlytask test:e2e # E2E tests onlytask test:coverage # Tests with coverage
# Framework-specific tests (isolated containers)task test:laravel10 # Laravel 10task test:laravel11 # Laravel 11task test:symfony6 # Symfony 6task test:symfony7 # Symfony 7
# Test matrix (all combinations)task test:matrix # Complete test matrixtask test:matrix:plain # Plain PHP onlytask test:matrix:laravel # All Laravel versionstask test:matrix:symfony # All Symfony versionstask test:matrix:doctrine # All Doctrine versions✨ Code Quality
Section titled “✨ Code Quality”# PHPStan (Level 9)task quality:phpstan # Run PHPStantask quality:phpstan:baseline # Generate baseline
# ECS (PHP Easy Coding Standard)task quality:ecs # Check code styletask quality:ecs:fix # Fix code style
# Rector (PHP Refactoring)task quality:rector # Check refactoringtask quality:rector:fix # Apply refactoring
# All checkstask quality:check # Run all quality checkstask dev:pre-commit # Pre-commit checks⚡ Benchmarking
Section titled “⚡ Benchmarking”task bench:run # Run benchmarkstask bench:compare # Compare with baselinetask bench:profile # Profile performance📚 Documentation
Section titled “📚 Documentation”task docs:dev # Start documentation server (http://localhost:4321)task docs:build # Build documentationtask docs:preview # Preview production build💻 Development Workflows
Section titled “💻 Development Workflows”task dev:setup # Complete development setuptask dev:pre-commit # Pre-commit checks (ECS + PHPStan + Tests)task dev:clean # Clean cache and temp filestask dev:reset # Reset environment (clean + rebuild)Common Workflows
Section titled “Common Workflows”Starting a New Feature
Section titled “Starting a New Feature”# 1. Update dependenciestask update
# 2. Create feature branchgit checkout -b feature/my-feature
# 3. Make changes and testtask test:run
# 4. Run quality checkstask quality:check
# 5. Commit and pushgit add .git commit -m "feat: add my feature"git push origin feature/my-featureRunning Tests Before Commit
Section titled “Running Tests Before Commit”# Quick pre-commit checktask dev:pre-commit
# Or run individual checkstask quality:ecs:fix # Fix code styletask quality:phpstan # Static analysistask test:run # Run testsTesting with Multiple PHP Versions
Section titled “Testing with Multiple PHP Versions”# Test with PHP 8.2task test:run PHP=8.2
# Test with PHP 8.3task test:run PHP=8.3
# Test with PHP 8.4task test:run PHP=8.4
# Or run complete test matrixtask test:matrixTroubleshooting
Section titled “Troubleshooting”Docker Issues
Section titled “Docker Issues”Containers won’t start:
task docker:cleantask docker:rebuildPermission issues:
# On Linux, you might need to fix permissionssudo chown -R $USER:$USER .Task Issues
Section titled “Task Issues”Task not found:
# Make sure Task is installedtask --version
# Or use direct commandsdocker-compose up -ddocker exec -it data-helpers-php84 composer installTest Failures
Section titled “Test Failures”Dependencies out of date:
task installCache issues:
task dev:cleanNext Steps
Section titled “Next Steps”- Contributing Guide - Learn how to contribute
- Testing Guide - Learn about testing
- Troubleshooting - Common issues and solutions