PHPackages                             jeylabs/laravel-aws-lambda - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jeylabs/laravel-aws-lambda

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jeylabs/laravel-aws-lambda
==========================

Laravel support for AWS Lambda.

25311PHP

Since Jun 6Pushed 6y ago2 watchersCompare

[ Source](https://github.com/jeylabs/laravel-aws-lambda)[ Packagist](https://packagist.org/packages/jeylabs/laravel-aws-lambda)[ RSS](/packages/jeylabs-laravel-aws-lambda/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel AWS Lambda
==================

[](#laravel-aws-lambda)

This package adds support to run Laravel in AWS Lambda.

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
    - [API Gateway Usage](#api-gateway-usage)
    - [SQS Usage](#sqs-usage)
    - [Running an Artisan Command](#running-an-artisan-command)
- [Security](#security)
- [Credits](#credits)

Installation
------------

[](#installation)

1. First, install the package via composer:

```
composer require jeylabs/laravel-aws-lambda
```

2. On versions of Laravel less than 5.5, you'll want to register the service provider. Add `Jeylabs\LaravelAwsLambda\LambdaServiceProvider::class,` to the `providers` array in `config/app.php`.
3. Install the provided files in your application:

```
php artisan vendor:publish --provider="Jeylabs\LaravelAwsLambda\LambdaServiceProvider"
```

### Advanced Installation Notes

[](#advanced-installation-notes)

- The ServiceProvider is only required when publishing the files from the package. Feel free to either remove, or wrap in an environment check not not load in production.

Usage
-----

[](#usage)

You'll need to run this in a Lambda runtime which supports executing php. See [aws-lambda-runtime-php](https://github.com/jeylabs/aws-lambda-php-runtime), which is the runtime we use for testing and development of the package.

Once the package is installed, upload your built Laravel application to AWS Lambda as a function. Specify the Handler as `handler.handler`; this will load the published `handler.php` which was provided at the root of your application, and then invoke the `handler()` entrypoint into the package, which will bootstrap your application.

Currently the package supports events from two AWS data sources:

- API Gateway
- SQS

Additionally, you may invoke the lambda (manually, or via CloudWatch events) with a custom JSON payload specifying an artisan command to be run.

#### API Gateway Usage

[](#api-gateway-usage)

Register a route (single route, or `{proxy+}`) which is configured as a `LAMBDA_PROXY`route passing the request through to your lambda function.

The Laravel AWS Lambda package will pass the API Gateway request through the HTTP Kernel, thus following your normal application routing. The response object will then be converted to a valid `LAMBDA_PROXY` response, and returned to the caller.

#### SQS Usage

[](#sqs-usage)

Configure an SQS queue to deliver messages to the AWS Lambda function. There is no need to configure or run a listener; the lambda will be invoked on demand when a message is delivered to the queue. It is recommended that you configure the batch size to `1`.

Publish a valid Laravel queue message via the Laravel SQS Queue driver.

The Lambda will be invoked, the package will process the received message, and instantiate your job class as per normal.

##### Notes about running SQS jobs via AWS Lambda

[](#notes-about-running-sqs-jobs-via-aws-lambda)

When running SQS jobs via Lambda, it is Lambda that is responsible for executing the `DeleteMessage` call against SQS after successful execution. This occurs when the Lambda execution exits successfully.

If you configure Lambda to invoke with a batch size that is not one, multiple jobs may be passed through to the Lambda invocation. The Laravel AWS Lambda package will handle this for you by running each job in series. However, if *any* job encounters a failure, *all* jobs in the batch will be failed and retried by Lambda.

Running multiple jobs per batch is supported, and should permit higher throughput, but you should be aware of the possible consequences, and ensure your application is designed to handle multiple executions of already-run-jobs.

#### Running an Artisan command

[](#running-an-artisan-command)

You can pass a custom payload through to the Lambda to run an Artisan command:

```
{
  "command": "inspire"
}
```

The above sample payload will invoke the `inspire` command. You can use custom payloads such as this either via manual invocation during process automations, or as scheduled executions via CloudWatch Events in place of commands you would typically run via the Artisan Scheduler.

Extending
---------

[](#extending)

The Larvel AWS Lambda package reads an array of `Handlers` from configuration specified in `config/aws-lambda.php`. You may add your own custom handlers to this list, if desired.

Handlers are passed the `$payload` of the lambda invocation when they are being created.

Next, in a loop, each Handler is evaluated by calling the `canHandle()` method. Your handler should examine the payload, and determine if this is a job that should be handled by this handler.

When a handler returns `true` to the `canHandle()` check, it's `handle()` method is called. You may type-hint dependencies in the `handle()` method and they will be injected by the IoC while calling the method, similar to how Controllers, Jobs, and other invocations work in Laravel.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

####

[](#httpsgithubcomin-touchlaravel-aws-lambda)

The project provided a great starting point, and sample code forinteracting with the Laravel AWS Lambda.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ed0d4b2d9847ab8f33bfaa6f10e26f331104554bd9ede60a59d12ebc7cca873?d=identicon)[jeylabs](/maintainers/jeylabs)

---

Top Contributors

[![pavinthan](https://avatars.githubusercontent.com/u/13897936?v=4)](https://github.com/pavinthan "pavinthan (8 commits)")

### Embed Badge

![Health badge](/badges/jeylabs-laravel-aws-lambda/health.svg)

```
[![Health](https://phpackages.com/badges/jeylabs-laravel-aws-lambda/health.svg)](https://phpackages.com/packages/jeylabs-laravel-aws-lambda)
```

###  Alternatives

[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31052.5M47](/packages/openlss-lib-array2xml)[makeusabrew/bootbox

Wrappers for JavaScript alert(), confirm() and other flexible dialogs using the Bootstrap framework

5.0k109.4k2](/packages/makeusabrew-bootbox)[jmikola/geojson

GeoJSON implementation for PHP

3109.0M77](/packages/jmikola-geojson)[apy/datagrid-bundle

Symfony Datagrid Bundle

502998.7k9](/packages/apy-datagrid-bundle)[gee-team/gt-php-sdk

GtWeb Php Demo

1165.1k4](/packages/gee-team-gt-php-sdk)[silvershop/silverstripe-listsorter

Easily provide front-end sorting controls for SilverStripe lists

1640.8k4](/packages/silvershop-silverstripe-listsorter)

PHPackages © 2026

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