steering_docs/php-tech/basics_scenario.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 structure")
# 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
Generate interactive scenarios that demonstrate complete workflows using multiple service operations in a guided, educational manner. Implementation must be based on the service SPECIFICATION.md file.
scenarios/basics/{service}/SPECIFICATION.mdtestable_readline() for user input and clear outputexample_code/{service}/
āāā Runner.php # Interactive menu runner
āāā {Service}Service.php # Service wrapper class
āāā composer.json
āāā README.md
āāā tests/
āāā {Service}Test.php
āāā phpunit.xml
```## MA
NDATORY Pre-Implementation Steps
### Step 1: Read Service Specification
**CRITICAL**: Always read `scenarios/basics/{service}/SPECIFICATION.md` first to understand:
- **API Actions Used**: Exact operations to implement
- **Proposed Example Structure**: Setup, demonstration, examination, cleanup phases
- **Error Handling**: Specific error codes and handling requirements
- **Scenario Flow**: Step-by-step workflow description
### Step 2: Extract Implementation Requirements
From the specification, identify:
- **Setup Phase**: What resources need to be created/configured
- **Demonstration Phase**: What operations to demonstrate
- **Examination Phase**: What data to display and how to filter/analyze
- **Cleanup Phase**: What resources to clean up and user options
## Runner Pattern Structure
**MANDATORY for most services:**
```php
<?php
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
require 'vendor/autoload.php';
use {Service}\{Service}Service;
echo "Welcome to the {AWS Service} examples!\n";
echo "Choose an option:\n";
echo "1. Hello {Service}\n";
echo "2. Run {Service} Basics Scenario\n";
echo "3. List {Resources}\n";
echo "4. Create {Resource}\n";
echo "5. Delete {Resource}\n";
echo "0. Exit\n";
$choice = testable_readline("Enter your choice: ");
switch ($choice) {
case '1':
require 'Hello{Service}.php';
break;
case '2':
$service = new {Service}Service();
runBasicsScenario($service);
break;
case '3':
$service = new {Service}Service();
$service->list{Resources}();
break;
case '4':
$service = new {Service}Service();
$resourceName = testable_readline("Enter resource name: ");
$service->create{Resource}($resourceName);
break;
case '5':
$service = new {Service}Service();
$resourceId = testable_readline("Enter resource ID: ");
$service->delete{Resource}($resourceId);
break;
case '0':
echo "Goodbye!\n";
break;
default:
echo "Invalid choice\n";
}
// Yes/No questions
$useExisting = testable_readline("Use existing resource? (y/n): ");
$isYes = strtolower($useExisting) === 'y';
// Text input
$resourceName = testable_readline("Enter resource name: ");
// Numeric input with validation
do {
$count = testable_readline("How many items? ");
} while (!is_numeric($count) || $count < 1);
// Progress indicators
echo "ā Operation completed successfully\n";
echo "ā Warning message\n";
echo "ā Error occurred\n";
// Formatted output
echo str_repeat('-', 60) . "\n";
echo "Found " . count($items) . " items:\n";
foreach ($items as $item) {
echo " ⢠{$item['name']}\n";
}
scenarios/basics/{service}/SPECIFICATION.mdtestable_readline()