Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions couscous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ menu:
text: Symfony
url: /docs/frameworks/symfony.html
title: Learn how to deploy serverless Symfony applications
symfony-runtime:
text: Symfony Runtime
url: /docs/frameworks/symfony-runtime.html
title: Learn how to deploy serverless application prowed by the Runtime component

functions:
- section: 'Bref for <strong class="text-gray-700">event-driven functions</strong>'
Expand Down
48 changes: 48 additions & 0 deletions docs/frameworks/symfony-runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Serverless applications with Symfony Runtime
current_menu: symfony-runtime
introduction: Learn how to deploy serverless applications on AWS Lambda using Bref and Symfony Runtime component.
---

The Symfony Runtime component was released with Symfony 5.3. All new Symfony
applications are using that component as default, but the component can also be
used with non-Symfony applications.

This guide helps you run any PHP applications on AWS Lambda using Bref and the Symfony
Runtime component.

## Setup

First, **follow the [Installation guide](../installation.md)** to create an AWS
account and install the necessary tools.

Next, in an any project using the [Symfony Runtime](https://symfony.com/doc/current/components/runtime.html),
install the Bref Runtime package.

```
composer require runtime/bref
```

If you are using [Symfony Flex](https://flex.symfony.com/), it will automatically run
the [runtime/bref recipe](https://github.com/symfony/recipes/tree/master/runtime/bref/0.2)
which will perform the following tasks:

- Create a `serverless.yml` configuration file.
- Add the `.serverless` folder to the `.gitignore` file.
- Add a `bootstrap` file in the project root.

> Otherwise, you can create the files yourself at the root of your project.
Take a look at the [serverless.yml](https://github.com/symfony/recipes/tree/master/runtime/bref/0.2/serverless.yaml)
and [bootstrap](https://github.com/symfony/recipes/tree/master/runtime/bref/0.2/bootstrap)
provided by the recipe.

You may still have a few modifications to do make your application compatible
with AWS Lambda. Since [the filesystem is readonly](/docs/environment/storage.md)
except for `/tmp` we need to customize where to store the cache, logs etc.

Take a look at the [Laravel](laravel.md) or [Symfony](symfony.md) setup guides how
they solve the problem.

## Deploy

The application is now ready to be deployed. Follow [the deployment guide](/docs/deploy.md).