The basics of using Serverless Framework for AWS Lambda PHP applications.
- Install Serverless Framework by following the Quick Start
- Set up your AWS credentials
- Create php binary by following steps in
doc/create_php_binary.md
- Write your serverless application (!) - the default is in
handler.php
- Run
sls deploy
to deploy to Lambda - Run
sls invoke -f hello -l
to invoke your function
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];
}