PHP code example of rousi / apigw-request-factory
1. Go to this page and download the library: Download rousi/apigw-request-factory 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/ */
rousi / apigw-request-factory example snippets
use Apigw\ServerRequestFactory;
use Apigw\ResponseEmitter;
use Nyholm\Psr7\Factory\Psr17Factory;
function handler($event, $context)
{
// Creating a psr-based request from an event
$request = ServerRequestFactory::from($event);
// Creating a psr-based response
$response = (new Psr17Factory)->createResponse(200);
// Here is your code!
return ResponseEmitter::emit($response);
}