Slide 21
Slide 21 text
x Laravel
21
service: laravel
provider:
name: aws
# The AWS region in which to deploy (us-east-
1
is the default)
region: us-east-
1
# Environment variables
environment:
APP_ENV: production # Or use ${sls:stage} if you want the environment to match the stage
package:
# Files and directories to exclude from deployment
patterns:
- '!node_modules/**'
- '!public/storage'
- '!resources/assets/**'
- '!storage/**'
- '!tests/**'
functions:
# This function runs the Laravel website/API
web:
handler: public/index.php
runtime: php-
8
1
-fpm
timeout:
28
# in seconds (API Gateway has a timeout of
2
9
seconds)
events:
- httpApi: '*'
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
runtime: php-
8
1
-console
timeout:
720
# in seconds
# Uncomment to also run the scheduler every minute
#events:
# - schedule:
# rate: rate(
1
minute)
# input: '"schedule:run"'
plugins:
# We need to include the Bref plugin
- ./vendor/bref/bref
Laravel public/index.php
Laravel Serverless Framework
$ composer require bref/bref bref/laravel-bridge update-with-dependencies
$ php artisan vendor:publish --tag=serverless-config