Skip to content

ThomasRedstone/aws-lambda-layer-php73

 
 

Repository files navigation

AWS Lambda PHP Hello World

The basics of using SAM Cli for AWS Lambda PHP applications.

Deploy

  1. Install SAM Cli by following the Quick Start
  2. Set up your AWS credentials
  3. Select one under the options
    1. Create php binary by following steps in doc/create_php_binary.md
    2. Use prebuilt Php 7.3.1
    3. Just put the yml this projects ARN arn:aws:lambda:eu-central-1:303814004728:layer:aws-lambda-layer-php-7-3-1:3
  4. Write your serverless application (!) - the default is in src/handlers/hello.php
  5. Run ./deploy.sh to deploy to Lambda

PHP handler function signature

Handler: filename.functionName hello.hello 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];
}

About

AWS lambda layer for php 7.3.1 and SAM Deployment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 72.8%
  • Dockerfile 13.8%
  • Shell 13.4%