1.0.1
A new Bref release already? Hell yeah! PHP 8 is there π
This release comes with new runtime versions:
- if you use
serverless.yml
, you don't have anything to do π (if you upgrade from Bref 0.5, read the 1.0 upgrade guide though) - if you use SAM or CloudFormation or Terraform or CDK, update the layer version numbers (see runtimes.bref.sh)
Enhancements:
- Upgrade all PHP versions, including PHP 8.0.0 π #802 (@shouze π )
- Report nested exception in logs #800 (@tyx)
- Expose API Gateway path parameters #805 (@mnapoli):
This makes API Gateway a bit more usable as an application router.
Here is an example:
functions:
get-article:
handler: get-article-handler.php
layers:
- ${bref:layer.php-74}
events:
- httpApi: 'GET /articles/{id}'
Path parameters (e.g. {id}
in the example above) are now available as request attributes in the PSR-7 request:
<?php
require __DIR__ . '/vendor/autoload.php';
use Nyholm\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
class HttpHandler implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
$id = $request->getAttribute('id');
return new Response(200, [], "Hello $id");
}
}
return new HttpHandler();
Looking to support the project? Check out:
- Serverless Visually Explained: an interactive course to learn how to create serverless applications
- 7777: easily connect to AWS databases from your computer