PHPackages                             dayspring-tech/lambda-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dayspring-tech/lambda-bundle

ActiveSymfony-bundle[API Development](/categories/api)

dayspring-tech/lambda-bundle
============================

Run symfony code via AWS Lambda

6.0.0(1y ago)040.9k↑231%MITPHPPHP &gt;=8.0CI passing

Since Oct 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/dayspring-tech/LambdaBundle)[ Packagist](https://packagist.org/packages/dayspring-tech/lambda-bundle)[ RSS](/packages/dayspring-tech-lambda-bundle/feed)WikiDiscussions 6.x Synced 1mo ago

READMEChangelog (7)Dependencies (7)Versions (11)Used By (0)

DayspringLambdaBundle - Run Symfony on Lambda
=============================================

[](#dayspringlambdabundle---run-symfony-on-lambda)

This bundle provides tooling for using Lambda to run Symfony code. Your application will run as a [custom Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html)

This is based on bref's [console example bootstrap script](https://github.com/brefphp/bref/blob/master/runtime/layers/console/bootstrap) and removes the need to use only console commands. It also boots the Symfony kernel once for the lifetime of the Lambda worker.

bref provides a Lambda runtime API client implementation. This handles communication with the [Lambda runtime API](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html)

Using this bundle
-----------------

[](#using-this-bundle)

### 1. Add this bundle to your Symfony project.

[](#1-add-this-bundle-to-your-symfony-project)

- Add this package to your project by running `composer require dayspring-tech/lambda-bundle`
- Package your project in a docker image.
- Add `Bootstrap/service.php` to your image as `/var/run/bootstrap`, and make it executable. This is the foundation of your custom Lambda runtime. ```
    # this is really what does the magic
    COPY symfony/vendor/dayspring-tech/lambda-bundle/Bootstrap/service.php /var/runtime/bootstrap
    RUN chmod a+x /var/runtime/bootstrap

    ```

### 2. Create a class that implements `LambdaHandlerServiceInterface`

[](#2-create-a-class-that-implements-lambdahandlerserviceinterface)

- Create a class that implements `LambdaHandlerServiceInterface` and register it with Symfony's dependency injection container. It should be marked as public so it can be fetched by name.
- Implement the `handle()` function
    - The custom runtime will call the `handle()` function for each Lambda event, passing the event object as the `$event` argument.
    - Lambda context information will be provided via the `$context` argument.
    - The custom runtime will provide an `OutputInterface` object with which you can provide any output that should be returned from the Lambda function.

### 3. Register a Lambda function

[](#3-register-a-lambda-function)

- Create a Lambda function in AWS using your docker image. Set the Lambda command to the service name.

Background on the custom Lambda runtimes and the Lambda Runtime API
-------------------------------------------------------------------

[](#background-on-the-custom-lambda-runtimes-and-the-lambda-runtime-api)

If there's a `/var/run/bootstrap` file in your docker image, Lambda will execute it. This is your custom runtime.

1. The Lambda runtime API exposes three APIs. Your custom runtime should call the `/next` API to request the next event.
2. Your custom runtime should execute code to handle the event. For LambdaBundle, this is calling the `handle()` function on the `LambdaHandlerServiceInterface` specified via the Lambda function's command parameter.
3. If successful, your custom runtime calls the `/response` API and POSTs the function's response.
4. On an error, your custom runtime calls the `/error` API with details of the error.

See also:

-
-

Provided Handlers
-----------------

[](#provided-handlers)

The following handlers are provided as examples or common implementations of `LambdaHandlerServiceInterface`

### EchoLambdaHandlerService

[](#echolambdahandlerservice)

This handler will echo the event `body` value to Lambda's output. Useful for testing your container and Lambda configuration.

```
{
    "body": "hello world"
}

```

### ServiceFunctionHandlerService

[](#servicefunctionhandlerservice)

This handler can handle lambda events and call any public function on any service available via Symfony's dependency injection container.

It expects a lambda event in the format:

```
{
    "serviceName": "AppBundle\\Service\\EchoService",
    "function": "echo",
    "args": [
        "hello"
    ]
}

```

- `serviceName`: any service identifier valid with `Container::get()`. This will likely be a service class name.
- `function`: the function name
- `args`: an array of arguments to the function

### SqsServiceFunctionHandlerService

[](#sqsservicefunctionhandlerservice)

This handler does the same thing as `ServiceFunctionHandlerService` but for messages sent via SQS

It expects payloads to be sent via SQS instead of directly to Lambda.

### Other implementation possibilities

[](#other-implementation-possibilities)

- API Gateway - Configure a Lambda integration with API Gateway and use Symfony to handle API requests
- SNS - Subscribe Lambda to a SNS topic and handle messages from SNS
- Custom events - Configure Lambda as a task within Step Functions

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance44

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~122 days

Recently: every ~165 days

Total

8

Last Release

441d ago

Major Versions

v0.5.0 → 6.0.02025-03-03

PHP version history (3 changes)v0.1.0PHP &gt;=7.0

v0.5.0PHP &gt;=7.4

6.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/092f64d077ad9ae39939fd3709afc416c4b3164fd23b020cd6ed314bdfe7c0fe?d=identicon)[jwong-dayspring](/maintainers/jwong-dayspring)

![](https://www.gravatar.com/avatar/8be6e72a9f57e5434d88defd3e21d983e01e93b4ca9a29b4d0a9ceb5a6e07532?d=identicon)[bwyu-dayspring](/maintainers/bwyu-dayspring)

---

Top Contributors

[![jwong-dayspring](https://avatars.githubusercontent.com/u/1828203?v=4)](https://github.com/jwong-dayspring "jwong-dayspring (35 commits)")

---

Tags

awssqslambda

###  Code Quality

TestsPHPUnit

Static AnalysisRector

### Embed Badge

![Health badge](/badges/dayspring-tech-lambda-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/dayspring-tech-lambda-bundle/health.svg)](https://phpackages.com/packages/dayspring-tech-lambda-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[bref/laravel-bridge

An advanced Laravel integration for Bref, including Octane support.

3384.1M11](/packages/bref-laravel-bridge)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[async-aws/lambda

Lambda client, part of the AWS SDK provided by AsyncAws.

194.5M10](/packages/async-aws-lambda)[bref/symfony-messenger

Symfony Messenger bridge to run with SQS and SNS on AWS Lambda with Bref

721.2M6](/packages/bref-symfony-messenger)[bref/symfony-bridge

Makes Symfony work on AWS Lambda with Bref

491.7M5](/packages/bref-symfony-bridge)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
