Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides AWS Lambda integration patterns for PHP with Symfony using the Bref framework. Creates Lambda handler classes, configures runtime layers, sets up SQS/SNS event triggers, implements warm-up strategies, and optimizes cold starts. Use when deploying PHP/Symfony applications to AWS Lambda, configuring API Gateway integration, implementing serverless PHP applications, or optimizing Lambda performance with Bref. Triggers include "create lambda php", "deploy symfony lambda", "bref lambda aws",
.claude/skills/giuseppe-trisciuoglio-aws-lambda-php-integration/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 64% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 166% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 89% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 62% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 60% | 0% |
Patterns for deploying PHP and Symfony applications on AWS Lambda using the Bref framework.
Two approaches available:
Both support API Gateway integration with production-ready configurations.
| Approach | Cold Start | Best For | Complexity | |----------|------------|----------|------------| | Bref | < 2s | Symfony apps, full-featured APIs | Medium | | Raw PHP | < 500ms | Simple handlers, maximum control | Low |
my-symfony-lambda/
├── composer.json
├── serverless.yml
├── public/
│ └── index.php # Lambda entry point
├── src/
│ └── Kernel.php # Symfony Kernel
├── config/
│ ├── bundles.php
│ ├── routes.yaml
│ └── services.yaml
└── templates/my-lambda-function/
├── public/
│ └── index.php # Handler entry point
├── composer.json
├── serverless.yml
└── src/
└── Services/Symfony with Bref:
php// public/index.php use Bref\Symfony\Bref; use App\Kernel; use Symfony\Component\HttpFoundation\Request; require __DIR__.'/../vendor/autoload.php'; $kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? true); $kernel->boot(); $bref = new Bref($kernel); return $bref->run($event, $context);
Raw PHP Handler:
php// public/index.php use function Bref\Lambda\main; main(function ($event) { $path = $event['path'] ?? '/'; $method = $event['httpMethod'] ?? 'GET'; return [ 'statusCode' => 200, 'body' => json_encode(['message' => 'Hello from PHP Lambda!']) ]; });
php// Cache AWS clients at function level use Aws\DynamoDb\DynamoDbClient; class DatabaseService { private static ?DynamoDbClient $client = null; public static function getClient(): DynamoDbClient { if (self::$client === null) { self::$client = new DynamoDbClient([ 'region' => getenv('AWS_REGION'), 'version' => 'latest' ]); } return self::$client; } }
json{ "require": { "php": "^8.2", "bref/bref": "^2.0", "symfony/framework-bundle": "^6.0" }, "config": { "optimize-autoloader": true, "preferred-install": "dist" } }
phptry { $result = processRequest($event); return [ 'statusCode' => 200, 'body' => json_encode($result) ]; } catch (ValidationException $e) { return [ 'statusCode' => 400, 'body' => json_encode(['error' => $e->getMessage()]) ]; } catch (Exception $e) { error_log($e->getMessage()); return [ 'statusCode' => 500, 'body' => json_encode(['error' => 'Internal error']) ]; }
phperror_log(json_encode([ 'level' => 'info', 'message' => 'Request processed', 'request_id' => $context->getAwsRequestId(), 'path' => $event['path'] ?? '/' ]));
yaml# serverless.yml service: symfony-lambda-api provider: name: aws runtime: php-82 memorySize: 512 timeout: 20 package: individually: true exclude: - '**/node_modules/**' - '**/.git/**' functions: api: handler: public/index.php events: - http: path: /{proxy+} method: ANY
bash# 1. Install Bref composer require bref/bref --dev # 2. Test locally (validate before deploy) sam local invoke -e event.json # 3. Deploy vendor/bin/bref deploy # 4. Verify deployment aws lambda invoke --function-name symfony-lambda-api-api \ --payload '{"path": "/", "httpMethod": "GET"}' /dev/stdout
yaml# serverless.yml for Symfony service: symfony-lambda-api provider: name: aws runtime: php-82 stage: ${self:custom.stage} region: ${self:custom.region} environment: APP_ENV: ${self:custom.stage} APP_DEBUG: ${self:custom.isLocal} iam: role: statements: - Effect: Allow Action: - dynamodb:GetItem - dynamodb:PutItem Resource: '*' functions: web: handler: public/index.php timeout: 30 memorySize: 1024 events: - http: path: /{proxy+} method: ANY console: handler: bin/console timeout: 300 events: - schedule: rate(1 day) plugins: - ./vendor/bref/bref custom: stage: dev region: us-east-1 isLocal: false
Input: "Create a Symfony Lambda REST API using Bref for a todo application"
Process:
composer create-projectcomposer require bref/brefsam local invokevendor/bin/bref deployaws lambda invoke --function-name <name> --payload '{}'Output: Complete Symfony project structure with REST API, DynamoDB integration, deployment configuration
Input: "My Symfony Lambda has 5 second cold start, how do I optimize it?"
Process:
Output: Refactored Symfony configuration with cold start < 2s
Input: "Configure CI/CD for Symfony Lambda with Serverless Framework"
Process:
Output: Complete .github/workflows/deploy.yml with multi-stage pipeline and test automation
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→fail | 16,442 | 11,312 | -31% | 1 | 1 | 0% | 3,048 | 4,633 | +52% | 0 | 0 | — |
case-01 | fail→fail | 15,552 | 12,539 | -19% | 1 | 1 | 0% | 2,913 | 4,810 | +65% | 0 | 0 | — |
case-03 | fail→fail | 17,108 | 7,458 | -56% | 1 | 1 | 0% | 2,769 | 3,491 | +26% | 0 | 0 | — |
case-04 | fail→pass | 14,707 | 10,207 | -31% | 1 | 1 | 0% | 2,829 | 4,637 | +64% | 0 | 0 | — |
case-05 | pass→pass | 9,931 | 6,683 | -33% | 1 | 1 | 0% | 1,753 | 3,579 | +104% | 0 | 0 | — |
case-06 | fail→pass | 6,062 | 4,178 | -31% | 1 | 1 | 0% | 1,156 | 3,075 | +166% | 0 | 0 | — |
case-07 | pass→pass | 15,221 | 9,661 | -37% | 1 | 1 | 0% | 2,446 | 3,960 | +62% | 0 | 0 | — |
case-08 | pass→pass | 9,597 | 7,170 | -25% | 1 | 1 | 0% | 1,683 | 3,586 | +113% | 0 | 0 | — |
case-09 | pass→pass | 13,622 | 12,994 | -5% | 1 | 1 | 0% | 2,583 | 4,903 | +90% | 0 | 0 | — |
case-10 | fail→pass | 10,800 | 8,556 | -21% | 1 | 1 | 0% | 2,133 | 4,037 | +89% | 0 | 0 | — |
case-11 | fail→pass | 18,461 | 15,696 | -15% | 1 | 1 | 0% | 3,085 | 5,005 | +62% | 0 | 0 | — |
case-12 | pass→pass | 15,156 | 10,308 | -32% | 1 | 1 | 0% | 2,498 | 4,065 | +63% | 0 | 0 | — |
case-22 | fail→fail | 20,495 | 14,843 | -28% | 1 | 1 | 0% | 3,514 | 5,070 | +44% | 0 | 0 | — |
case-13 | pass→pass | 7,364 | 4,213 | -43% | 1 | 1 | 0% | 1,396 | 3,226 | +131% | 0 | 0 | — |
case-14 | pass→pass | 12,069 | 8,760 | -27% | 1 | 1 | 0% | 2,271 | 4,046 | +78% | 0 | 0 | — |
case-15 | fail→pass | 16,277 | 12,304 | -24% | 1 | 1 | 0% | 2,806 | 4,503 | +60% | 0 | 0 | — |
case-16 | pass→pass | 18,835 | 19,361 | +3% | 1 | 1 | 0% | 3,062 | 6,164 | +101% | 0 | 0 | — |
case-17 | fail→fail | 10,935 | 10,808 | -1% | 1 | 1 | 0% | 1,944 | 4,256 | +119% | 0 | 0 | — |
case-18 | pass→pass | 14,529 | 14,922 | +3% | 1 | 1 | 0% | 2,522 | 4,928 | +95% | 0 | 0 | — |
case-19 | fail→pass | 13,697 | 8,500 | -38% | 1 | 1 | 0% | 2,614 | 3,940 | +51% | 0 | 0 | — |
case-20 | pass→pass | 13,266 | 7,800 | -41% | 1 | 1 | 0% | 1,981 | 3,545 | +79% | 0 | 0 | — |
case-21 | fail→fail | 18,133 | 14,747 | -19% | 1 | 1 | 0% | 3,407 | 5,183 | +52% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +27 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.