Download the PHP package bref/symfony-bridge without Composer
On this page you can find all versions of the php package bref/symfony-bridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package symfony-bridge
Bref runtime to run Symfony on AWS Lambda.
Installation
Usage
You only need to do one small change to quickly setup Symfony to work with Bref.
Now you are up and running.
Optimize first request
The first HTTP request that hits your application after you deployed a new version will use a cold cache directory. Symfony now spends time building thc cache. It may take everything between 1-20 seconds depending on the complexity of the application.
Technically this happens whenever your application run on a new Lambda. That could be when you get a lot more traffic so AWS increases the resources or when AWS just decides to kill the lambda function (or server) that you are currently on. It is normal that this happens at least a handful of times every day.
To optimize the first request, one must deploy the application with a warm cache.
In a simple application it means that the deploy script should include cache:warmup
to look something like this:
Optimize cache
When running Symfony on Lambda you should avoid writing to the filesystem. If
you prewarm the cache before deploy you are mostly fine. But you should also make
sure you never write to a filesystem cache like cache.system
or use a pool like:
If you don't write to such cache pool you can optimize your setup by not copy the
var/cache/pools
directory. The change below will make sure to symlink the pools
directory.
Handling requests in a kept-alive process without FPM
Note: this is an advanced topic. Don't bother with this unless you know what you are doing.
To handle HTTP requests via the Symfony Kernel, without using PHP-FPM, by keeping the process alive:
The App\Kernel
will be retrieved via Symfony Runtime from public/index.php
. If you don't have a public/index.php
, read the next sections.
Class handlers
To handle other events (e.g. SQS messages with Symfony Messenger) via a class name:
The service will be retrieved via Symfony Runtime from the Symfony Kernel returned by public/index.php
.
Note: the service must be configured as public (
public: true
) in the Symfony configuration.
Custom bootstrap file
If you do not have a public/index.php
file, you can create a file that returns the kernel (or any PSR-11 container):
And configure it in serverless.yml
:
All versions of symfony-bridge with dependencies
bref/bref Version ^1.2|^2.0
symfony/filesystem Version ^5.4|^6.0|^7.0
symfony/http-kernel Version ^5.4|^6.0|^7.0
symfony/psr-http-message-bridge Version ^2.1|^6.4|^7.0
symfony/runtime Version ^5.4|^6.0|^7.0