https://github.com/akrabat/lambda-php
The basics of using Serverless Framework for AWS Lambda PHP applications.
https://github.com/akrabat/lambda-php
Last synced: 9 months ago
JSON representation
The basics of using Serverless Framework for AWS Lambda PHP applications.
- Host: GitHub
- URL: https://github.com/akrabat/lambda-php
- Owner: akrabat
- License: mit
- Created: 2018-12-31T22:52:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-26T20:01:28.000Z (almost 7 years ago)
- Last Synced: 2025-03-28T15:11:43.984Z (9 months ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 82
- Watchers: 5
- Forks: 20
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS Lambda PHP Hello World
The basics of using [Serverless Framework][1] for AWS Lambda PHP applications.
## Notes
1. Install Serverless Framework by following the [Quick Start][2]
2. Set up your [AWS credentials][3]
3. Create php binary layer and upload to AWS by following steps in [`php-runtime/README.md`][4]
4. Write your serverless application (!) - the default is in `hello-world/handler.php`
5. Run `sls deploy` to deploy to Lambda
6. Run `sls invoke -f hello -l` to invoke your function
As 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"}'
## PHP handler function signature
The signature for the PHP function is:
function main($eventData) : array
Hello world looks like:
"Hello from PHP " . PHP_VERSION];
}
[1]: https://serverless.com
[2]: https://serverless.com/framework/docs/providers/aws/guide/quick-start/
[3]: https://serverless.com/framework/docs/providers/aws/guide/credentials/
[4]: php-runtime/README.md