Help us improve
Share bugs, ideas, or general feedback.
From developer-kit-php
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.
npx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit-phpHow this skill is triggered — by the user, by Claude, or both
Slash command
/developer-kit-php:aws-lambda-php-integrationThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Patterns for deploying PHP and Symfony applications on AWS Lambda using the Bref framework.
Provides AWS Lambda patterns for Python functions using Chalice or raw Python, with cold start optimization and API Gateway/ALB integration for serverless apps.
Provides AWS CloudFormation templates and workflows for Lambda functions, layers, API Gateway integration, event sources, cold start optimization, monitoring, validation, and deployment. Use for Lambda infrastructure on AWS.
Builds production-ready AWS serverless applications with Lambda functions, API Gateway, DynamoDB, SQS/SNS event patterns, SAM/CDK deployment, and cold start optimization.
Share bugs, ideas, or general feedback.
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