Generates AWS Lambda handlers and configs for PHP/Symfony apps using Bref: runtime layers, SQS/SNS triggers, API Gateway integration, warm-up strategies, cold start optimization.
From developer-kit-phpnpx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit-phpThis skill is limited to using the following tools:
references/best-practices.mdreferences/bref-lambda.mdreferences/examples.mdreferences/patterns.mdreferences/raw-php-lambda.mdreferences/serverless-deployment.mdreferences/testing-lambda.mdSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
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:
// 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:
// 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!'])
];
});
// 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;
}
}
{
"require": {
"php": "^8.2",
"bref/bref": "^2.0",
"symfony/framework-bundle": "^6.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist"
}
}
try {
$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'])
];
}
error_log(json_encode([
'level' => 'info',
'message' => 'Request processed',
'request_id' => $context->getAwsRequestId(),
'path' => $event['path'] ?? '/'
]));
# 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
# 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
# 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