PHP code example of ssigwart / lambda-php
1. Go to this page and download the library: Download ssigwart/lambda-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ssigwart / lambda-php example snippets
use ssigwart\LambdaRuntime\LambdaHandlerInterface;
/** Simple lamdba handler */
class MyHandler implements LambdaHandlerInterface
{
/**
* Handle request
*
* @param string $invocationId Invocation ID
* @param string $payload Payload (typically JSON)
*
* @return string Response
*/
public function handleRequest(string $invocationId, string $payload): string
{
return 'Invocation ' . $invocationId . ' with payload: ' . $payload;
}
}
// Set handler
\LambdaRuntimeBootstrap\RuntimeBootstrap::setHandler(new MyHandler());