Awesome Open Source
Awesome Open Source


serverless language license

PHP for AWS Lambda via Serverless Framework using Symfony components for dependency injection.

Latest version is on master.

AWS Lambda lets you run code without thinking about servers. Right now you can author your AWS Lambda functions in several langauges natively, but not PHP. This project aims to provide a fully featured shim for authoring your AWS Lambda functions in PHP.

More information about how this works and its performance characteristics can be found on my blog post.



use Raines\Serverless\Context;
use Raines\Serverless\Handler;

class HelloHandler implements Handler
    public function handle(array $event, Context $context)
        return [
            'statusCode' => 200,
            'body' => 'Hello World!',


Event Data Context Logging Exceptions Environment API Gateway
full full part none full full



Install this project:

serverless install --url

Currently serverless install does not work with Git LFS. Hopefully this will be supported in the future, but for the moment here are your options:

  1. Rebuild the PHP binary (described later in this document)
  2. Download the PHP binary directly from GitHub
  3. Instead of using serverless install, ensure you have Git LFS installed on your system and clone the repository.

Deploying to AWS

composer install -o --no-dev
serverless deploy

Running locally

serverless invoke local -f hello

Running on AWS

serverless invoke -f hello

Rebuilding PHP Binary

The PHP binary can be built with any flags you require and at any version.




Altering compile flags etc

Edit and dockerfile.buildphp to alter it.


Alternatives To Serverless Php
Select To Compare

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Php (287,456
Amazon Web Services (38,412
Lambda Functions (13,970
Serverless (9,908
Aws Lambda (3,427
Serverless Framework (1,271