The basics of using Serverless Framework for AWS Lambda PHP applications.
The basics of using Serverless Framework for AWS Lambda PHP applications.
php-runtime/README.md
hello-world/handler.php
sls deploy
to deploy to Lambdasls invoke -f hello -l
to invoke your functionAs we’ve used Docker to create the runtime, you can test locally using the Dockerfile
in hello-world
:
$ cd hello-world
$ docker build -t lambda-php-test . && docker run lambda-php-test handler.hello '{"name": "world"}'
The signature for the PHP function is:
function main($eventData) : array
Hello world looks like:
<?php
function hello($eventData) : array
{
return ["msg" => "Hello from PHP " . PHP_VERSION];
}