← 返回首页
localstack-pro-samples/lambda-php-bref-cdk-app at master · localstack-samples/localstack-pro-samples · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Latest commit

 

History

History
 master
Top

README.md

PHP/Bref Lambda with CDK

Key Value
Services Lambda, API Gateway
Integrations AWS CDK, Bref, PHP
Categories Serverless; PHP

Introduction

A PHP/Bref serverless application using a shared Lambda layer deployable with AWS CDK to LocalStack. The application implements a typed PHP Lambda handler as an HTTP handler class for serving API Gateway HTTP events. Bref turns API Gateway events into PSR-7 requests for PHP processing.

Prerequisites

Check prerequisites

make check

Installation

make install

Start LocalStack

export LOCALSTACK_AUTH_TOKEN=<your-auth-token> make start

Run the application

make run

The script bootstraps and deploys the CDK app locally, then invokes the HTTP endpoint via curl. You should see output similar to:

Outputs: CdkBrefStack.Url = https://bd0f6b19.execute-api.localhost.localstack.cloud:4566/ Stack ARN: arn:aws:cloudformation:us-east-1:000000000000:stack/CdkBrefStack/dec480c5 ✨ Total time: 7.9s CDK app successfully deployed. Now trying to invoke the Lambda through API gateway. endpoint=https://bd0f6b19.execute-api.localhost.localstack.cloud:4566/ Hello LocalStack!

PHP/Bref with FPM and Serverless Framework

Bref also supports running web applications on AWS Lambda via php-fpm, enabling traditional PHP frameworks like Laravel and Symfony. To deploy a php-fpm Laravel project from brefphp/examples to LocalStack:

  1. Install the serverless-localstack plugin:

    npm install --save-dev serverless-localstack
  2. Add serverless-localstack to plugins in serverless.yml:

    plugins: - ./vendor/bref/bref - serverless-localstack
  3. Add custom properties:

    custom: localstack: stages: - local
  4. Deploy:

    serverless deploy --stage local

License

This code is available under the Apache 2.0 license.

Footer

© 2026 GitHub, Inc.