Minimalistic AWS SAM PHP
May 22, 2021
Setup
Use Bref Runtimes Layers, for running PHP on Lambda.
Type: AWS::Serverless::Function
Properties:
Layers: ["arn:aws:lambda:eu-west-1:209497400698:layer:php-80:9"]
Composer
bref/bref
composer package is required to create communication between the PHP and the Lambda API.composer.json
&composer.lock
should be added on the same level as the entry php file.- Finally
composer install
should be run before deploying the infrastructure.
See https://github.com/rdok/aws-sam-php for a live scenario.
Original Post https://stories.rdok.co.uk/2021/05/aws-sam-php/