Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.
82
82%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Risky
Do not use without reviewing
Minimal PHP Lambda handler patterns without framework overhead for maximum performance.
{
"name": "my/lambda-function",
"description": "Raw PHP Lambda",
"require": {
"php": "^8.2",
"bref/bref": "^2.0",
"aws/aws-sdk-php": "^3.300"
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"config": {
"optimize-autoloader": true
}
}my-lambda-function/
├── composer.json
├── serverless.yml
├── public/
│ └── index.php
├── src/
│ ├── Handler.php
│ └── Services/
│ └── DynamoDbService.php
└── conf.d/
└── lambda.ini// public/index.php
use function Bref\Lambda\handler;
handler(function (array $event, $context) {
$path = $event['path'] ?? '/';
$method = $event['httpMethod'] ?? 'GET';
switch ($path) {
case '/health':
return healthCheck();
case '/users':
return handleUsers($method, $event);
default:
return notFound();
}
});
function healthCheck(): array
{
return [
'statusCode' => 200,
'body' => json_encode(['status' => 'ok'])
];
}
function handleUsers(string $method, array $event): array
{
return match($method) {
'GET' => listUsers($event),
'POST' => createUser($event),
default => methodNotAllowed()
};
}
function listUsers(array $event): array
{
return [
'statusCode' => 200,
'body' => json_encode(['users' => []])
];
}
function createUser(array $event): array
{
$body = json_decode($event['body'] ?? '{}', true);
return [
'statusCode' => 201,
'body' => json_encode(['id' => 'new-user-id'])
];
}
function notFound(): array
{
return [
'statusCode' => 404,
'body' => json_encode(['error' => 'Not found'])
];
}
function methodNotAllowed(): array
{
return [
'statusCode' => 405,
'body' => json_encode(['error' => 'Method not allowed'])
];
}// public/index.php
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Response;
use function Bref\Lambda\handler;
class PsrHandler implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
$path = $request->getUri()->getPath();
if ($path === '/api/users') {
return new Response(
200,
['Content-Type' => 'application/json'],
json_encode(['users' => []])
);
}
return new Response(404, [], json_encode(['error' => 'Not found']));
}
}
handler(function (array $event, $context) {
$request = ServerRequest::fromArrays(
$event['headers'] ?? [],
[], // query params
$event['body'] ?? null,
$event['httpMethod'] ?? 'GET',
$event['path'] ?? '/'
);
$handler = new PsrHandler();
$response = $handler->handle($request);
return [
'statusCode' => $response->getStatusCode(),
'headers' => $response->getHeaders(),
'body' => (string) $response->getBody()
];
});// src/Services/LazyServiceLoader.php
class LazyServiceLoader
{
private static array $cache = [];
public static function getDynamoDbClient(): \Aws\DynamoDb\DynamoDbClient
{
$key = 'dynamodb';
if (!isset(self::$cache[$key])) {
self::$cache[$key] = new \Aws\DynamoDb\DynamoDbClient([
'region' => getenv('AWS_REGION') ?: 'us-east-1',
'version' => 'latest',
]);
}
return self::$cache[$key];
}
}// src/Services/UserService.php
class UserService
{
private static ?self $instance = null;
private \Aws\DynamoDb\DynamoDbClient $db;
private function __construct()
{
$this->db = LazyServiceLoader::getDynamoDbClient();
}
public static function getInstance(): self
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
public function getUser(string $id): array
{
$result = $this->db->getItem([
'TableName' => getenv('USERS_TABLE'),
'Key' => ['id' => ['S' => $id]]
]);
return $result['Item'] ?? [];
}
}// public/index.php
// Declare at the top - persists across warm invocations
$dbClient = null;
$tableName = null;
function getDbClient(): \Aws\DynamoDb\DynamoDbClient
{
global $dbClient;
if ($dbClient === null) {
$dbClient = new \Aws\DynamoDb\DynamoDbClient([
'region' => getenv('AWS_REGION') ?: 'us-east-1',
'version' => 'latest',
]);
}
return $dbClient;
}
function getTableName(): string
{
global $tableName;
if ($tableName === null) {
$tableName = getenv('USERS_TABLE') ?: 'users';
}
return $tableName;
}
handler(function (array $event, $context) {
$client = getDbClient();
$table = getTableName();
$result = $client->scan([
'TableName' => $table
]);
return [
'statusCode' => 200,
'body' => json_encode($result['Items'])
];
});// src/Services/DynamoDbService.php
class DynamoDbService
{
private \Aws\DynamoDb\DynamoDbClient $client;
private string $tableName;
public function __construct(string $tableName)
{
$this->client = new \Aws\DynamoDb\DynamoDbClient([
'region' => getenv('AWS_REGION') ?: 'us-east-1',
'version' => 'latest',
]);
$this->tableName = $tableName;
}
public function get(string $id): ?array
{
$result = $this->client->getItem([
'TableName' => $this->tableName,
'Key' => ['id' => ['S' => $id]]
]);
return $result['Item'] ?? null;
}
public function put(string $id, array $data): void
{
$item = ['id' => ['S' => $id]];
foreach ($data as $key => $value) {
$item[$key] = is_string($value) ? ['S' => $value] : ['N' => (string) $value];
}
$this->client->putItem([
'TableName' => $this->tableName,
'Item' => $item
]);
}
public function delete(string $id): void
{
$this->client->deleteItem([
'TableName' => $this->tableName,
'Key' => ['id' => ['S' => $id]]
]);
}
public function query(string $pk, string $sk = null): array
{
$params = [
'TableName' => $this->tableName,
'KeyConditionExpression' => 'id = :id',
'ExpressionAttributeValues' => [':id' => ['S' => $pk]]
];
if ($sk) {
$params['KeyConditionExpression'] .= ' AND sort = :sort';
$params['ExpressionAttributeValues'][':sort'] = ['S' => $sk];
}
$result = $this->client->query($params);
return $result['Items'] ?? [];
}
}class S3Service
{
private \Aws\S3\S3Client $client;
private string $bucket;
public function __construct(string $bucket)
{
$this->client = new \Aws\S3\S3Client([
'region' => getenv('AWS_REGION') ?: 'us-east-1',
'version' => 'latest',
]);
$this->bucket = $bucket;
}
public function getObject(string $key): string
{
$result = $this->client->getObject([
'Bucket' => $this->bucket,
'Key' => $key
]);
return (string) $result['Body'];
}
public function putObject(string $key, string $content, string $contentType = 'text/plain'): void
{
$this->client->putObject([
'Bucket' => $this->bucket,
'Key' => $key,
'Body' => $content,
'ContentType' => $contentType
]);
}
}# serverless.yml
service: raw-php-lambda
provider:
name: aws
runtime: php-82
memorySize: 256
timeout: 10
environment:
AWS_REGION: us-east-1
USERS_TABLE: !Ref UsersTable
functions:
api:
handler: public/index.php
events:
- httpApi:
path: /{proxy+}
method: ANY
- httpApi:
path: /
method: ANY
resources:
Resources:
UsersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: users
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
plugins:
- ./vendor/bref/bref# Install dependencies
composer install --no-dev
# Deploy
vendor/bin/bref deployfunction handleError(\Throwable $e): array
{
error_log(json_encode([
'error' => $e->getMessage(),
'type' => get_class($e),
'trace' => $e->getTraceAsString()
]));
$statusCode = match (true) {
$e instanceof \InvalidArgumentException => 400,
$e instanceof \RuntimeException => 500,
default => 500
};
return [
'statusCode' => $statusCode,
'body' => json_encode([
'error' => $e->getMessage()
])
];
}
handler(function (array $event, $context) {
try {
// Process request
} catch (\Throwable $e) {
return handleError($e);
}
});function logRequest(string $level, array $data): void
{
$logData = [
'timestamp' => date('c'),
'level' => $level,
'aws_request_id' => $context->getAwsRequestId(),
...$data
];
error_log(json_encode($logData));
}
// Usage
logRequest('info', [
'event' => 'request_received',
'path' => $event['path'],
'method' => $event['httpMethod']
]);plugins
developer-kit-ai
skills
chunking-strategy
prompt-engineering
developer-kit-aws
skills
aws
aws-cli-beast
aws-cost-optimization
aws-drawio-architecture-diagrams
aws-sam-bootstrap
aws-cloudformation
aws-cloudformation-auto-scaling
references
aws-cloudformation-bedrock
references
aws-cloudformation-cloudfront
references
aws-cloudformation-cloudwatch
references
aws-cloudformation-dynamodb
references
aws-cloudformation-ec2
aws-cloudformation-ecs
references
aws-cloudformation-elasticache
aws-cloudformation-iam
references
aws-cloudformation-lambda
references
aws-cloudformation-rds
aws-cloudformation-s3
references
aws-cloudformation-security
references
aws-cloudformation-task-ecs-deploy-gh
aws-cloudformation-vpc
developer-kit-core
skills
developer-kit-java
skills
aws-lambda-java-integration
aws-rds-spring-boot-integration
aws-sdk-java-v2-bedrock
aws-sdk-java-v2-core
aws-sdk-java-v2-dynamodb
aws-sdk-java-v2-kms
aws-sdk-java-v2-lambda
aws-sdk-java-v2-messaging
aws-sdk-java-v2-rds
aws-sdk-java-v2-s3
aws-sdk-java-v2-secrets-manager
graalvm-native-image
langchain4j
langchain4j-mcp-server-patterns
langchain4j-ai-services-patterns
references
langchain4j-mcp-server-patterns
references
langchain4j-rag-implementation-patterns
references
langchain4j-spring-boot-integration
langchain4j-testing-strategies
langchain4j-tool-function-calling-patterns
langchain4j-vector-stores-configuration
references
qdrant
references
spring-ai-mcp-server-patterns
references
spring-boot-actuator
spring-boot-cache
spring-boot-crud-patterns
spring-boot-dependency-injection
spring-boot-event-driven-patterns
spring-boot-openapi-documentation
spring-boot-project-creator
spring-boot-resilience4j
spring-boot-rest-api-standards
spring-boot-saga-pattern
spring-boot-security-jwt
assets
references
scripts
spring-boot-test-patterns
spring-data-jpa
references
spring-data-neo4j
references
unit-test-application-events
unit-test-bean-validation
unit-test-boundary-conditions
unit-test-caching
unit-test-config-properties
unit-test-controller-layer
unit-test-exception-handler
unit-test-json-serialization
unit-test-mapper-converter
unit-test-parameterized
unit-test-scheduled-async
unit-test-service-layer
unit-test-utility-methods
unit-test-wiremock-rest-api
developer-kit-php
skills
aws-lambda-php-integration
developer-kit-python
skills
aws-lambda-python-integration
developer-kit-tools
developer-kit-typescript
skills
aws-lambda-typescript-integration
better-auth
drizzle-orm-patterns
dynamodb-toolbox-patterns
references
nestjs
nestjs-best-practices
nestjs-code-review
nestjs-drizzle-crud-generator
scripts
nextjs-app-router
nextjs-authentication
nextjs-code-review
nextjs-data-fetching
references
nextjs-deployment
nextjs-performance
nx-monorepo
react-code-review
react-patterns
references
shadcn-ui
tailwind-css-patterns
references
tailwind-design-system
references
turborepo-monorepo
typescript-docs
typescript-security-review
zod-validation-utilities