steering_docs/php-tech/orchestration.md
🚨 CRITICAL - Must be completed BEFORE any code generation
# Step 1: List available knowledge bases
ListKnowledgeBases()
# Step 2: Query coding standards (REQUIRED)
QueryKnowledgeBases("coding-standards-KB", "PHP-code-example-standards")
# Step 3: Query implementation patterns (REQUIRED)
QueryKnowledgeBases("PHP-premium-KB", "PHP implementation patterns orchestration")
# Step 4: AWS service research (REQUIRED)
search_documentation("What is [AWS Service] and what are its key API operations?")
read_documentation("https://docs.aws.amazon.com/[service]/latest/[relevant-page]")
FAILURE TO COMPLETE KNOWLEDGE BASE CONSULTATION WILL RESULT IN INCORRECT CODE STRUCTURE
Define build processes, dependency management, code quality checks, and execution workflows for PHP AWS SDK examples.
# Dependencies
composer install # Install dependencies
composer update # Update dependencies
composer dump-autoload # Regenerate autoloader
# Testing
phpunit # Run all tests
phpunit --testsuite unit # Run unit tests
phpunit --group unit # Run unit tests by group
phpunit --group integ # Run integration tests
composer test # Run tests via composer script
composer test-unit # Run unit tests via composer script
composer test-integ # Run integration tests via composer script
# Code Quality
vendor/bin/phpcs --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./
vendor/bin/phpcbf --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./
# Execution
php Runner.php # Run example with Runner pattern
php Hello{Service}.php # Run hello scenario directly
php {Service}Actions.php # Run individual actions
❌ WORK IS NOT COMPLETE UNTIL ALL THESE COMMANDS PASS:
# 1. MANDATORY: Dependencies must be installed
composer install
# 2. MANDATORY: Composer configuration must be valid
composer validate
# 3. MANDATORY: Autoloading must work
composer dump-autoload
# 4. MANDATORY: Unit tests must pass
phpunit --group unit
# 5. MANDATORY: Integration tests must pass (if applicable)
phpunit --group integ
# 6. MANDATORY: Code formatting must be applied
vendor/bin/phpcbf --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./
# 7. MANDATORY: Linting must pass
vendor/bin/phpcs --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./
# 8. MANDATORY: ALL EXAMPLE FILES MUST BE EXECUTED TO VALIDATE CREATION
php Hello{Service}.php
php Runner.php
# Test service class instantiation
php -r "require 'vendor/autoload.php'; use {Service}\{Service}Service; \$service = new {Service}Service(); echo '✅ Service class working\n';"
🚨 CRITICAL: If ANY of these commands fail, the work is INCOMPLETE and must be fixed.
🚨 MANDATORY VALIDATION REQUIREMENT:
{
"require": {
"php": "^8.1",
"aws/aws-sdk-php": "^3.209",
"ext-readline": "*"
}
}
{
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.6"
}
}
{
"scripts": {
"test": "phpunit",
"test-unit": "phpunit --group unit",
"test-integ": "phpunit --group integ",
"lint": "phpcs --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./",
"lint-fix": "phpcbf --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./"
}
}
.github/linters/# Check code style
vendor/bin/phpcs --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./
# Fix code style automatically
vendor/bin/phpcbf --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./
# Run all tests
composer test
# Run specific test groups
composer test-unit
composer test-integ
# Run tests with coverage (if configured)
phpunit --coverage-html coverage/
# Run specific test file
phpunit tests/ServiceTest.php
# Primary entry point
php Runner.php
# Direct hello execution
php Hello{Service}.php
# Service class testing
php -r "
require 'vendor/autoload.php';
use {Service}\{Service}Service;
\$service = new {Service}Service();
var_dump(\$service->listResources());
"
# Non-interactive testing
PHPUNIT_TESTING=1 php Runner.php
# Batch execution with input
echo -e "1\n0\n" | php Runner.php
# Required PHP extensions
php -m | grep -E "(curl|json|mbstring|openssl|readline)"
# Memory and execution limits
php -d memory_limit=256M -d max_execution_time=300 Runner.php
#!/bin/bash
# Pre-commit validation script
echo "Running PHP validation..."
# 1. Syntax check
find . -name "*.php" -exec php -l {} \; | grep -v "No syntax errors"
# 2. Composer validation
composer validate --strict
# 3. Code style check
vendor/bin/phpcs --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor ./
# 4. Unit tests
phpunit --group unit
echo "✅ All checks passed"
# Example GitHub Actions workflow
name: PHP Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: curl, json, mbstring, openssl, readline
- name: Install dependencies
run: composer install
- name: Run tests
run: composer test
- name: Check code style
run: composer lint
# Debug composer issues
composer diagnose
# Debug autoloading
composer dump-autoload -v
# Debug PHP configuration
php --ini
php -m
# Debug AWS credentials
aws sts get-caller-identity