Skip to content
Merged
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
1 change: 0 additions & 1 deletion .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<!-- Show sniff names -->
<arg value="s"/>

<file>bref</file>
<file>src</file>
<file>tests</file>

Expand Down
132 changes: 0 additions & 132 deletions bref

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
}
},
"bin": [
"bref",
"src/bref-local"
],
"require": {
Expand Down
43 changes: 27 additions & 16 deletions docs/default/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,29 @@ Next, in an empty directory, install Bref using Composer:
composer require bref/bref
```

Make sure that the version of Bref that was installed is 1.0 or greater.
Make sure that the version of Bref that was installed is 3.0 or greater.

Then let's start by initializing a new project by running:
Then, create a `serverless.yml` file. This file will describe how to deploy your application.

```bash
vendor/bin/bref init
```

Accept all the defaults by pressing "Enter". The following files will be created in your project:

- `index.php` contains the code of your application
- `serverless.yml` contains the configuration for deploying on AWS

You are free to edit `index.php`.
```yml filename="serverless.yml"
service: app # your application name (lowercase without spaces)

To deploy an existing application, you can delete `index.php` and edit `serverless.yml` to point to your existing index file (for example it may be another file like `public/index.php`). You can also create the `serverless.yml` file manually:
bref:
# Uncomment and set your team ID if you are using Bref Cloud
#team: bref-team-id

```yml filename="serverless.yml"
service: app
provider:
name: aws
region: us-east-1
region: us-east-1 # AWS region to deploy to
environment: # Environment variables
APP_ENV: prod

functions:
web:
# `index.php` is the entrypoint of your application
handler: index.php
runtime: php-84-fpm
timeout: 28 # in seconds (API Gateway has a max timeout of 29 seconds)
events:
- httpApi: '*'

Expand All @@ -66,6 +62,21 @@ plugins:
- ./vendor/bref/bref
```

If your `index.php` entrypoint is in a different folder, feel free to adjust the `handler` key. For example if it is in `public/index.php`:

```yml
handler: public/index.php
```

If this is a new application, you can create a very simple `index.php` file to test things out, for example:

```php
<?php
echo 'Hello world!';
```

You will also want to add `.serverless` to your `.gitignore`.

## Deployment

To deploy, run:
Expand Down
51 changes: 46 additions & 5 deletions docs/symfony/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,54 @@ Next, in an existing Symfony project, install Bref and the [Symfony Bridge packa
composer require bref/bref bref/symfony-bridge --update-with-dependencies
```

Next, create a `serverless.yml` configuration file at the root of your project by running:

```bash
vendor/bin/bref init symfony
Next, create a `serverless.yml` configuration file at the root of your project:

```yml filename="serverless.yml"
service: app # your application name (lowercase without spaces)

bref:
# Uncomment and set your team ID if you are using Bref Cloud
#team: bref-team-id

provider:
name: aws
region: us-east-1 # AWS region to deploy to
environment: # Environment variables
APP_ENV: prod

functions:
# This function runs the Symfony website/API
web:
handler: public/index.php
runtime: php-84-fpm
timeout: 28 # in seconds (API Gateway has a max timeout of 29 seconds)
events:
- httpApi: '*'
# This function let us run console commands in Lambda
console:
handler: bin/console
runtime: php-84-console
timeout: 120 # in seconds

package:
patterns:
# Excluded files and folders for deployment
- '!assets/**'
- '!node_modules/**'
- '!public/build/**'
- '!tests/**'
- '!var/**'
# If you want to include files and folders that are part of excluded folders,
# add them at the end
- 'var/cache/prod/**'
- 'public/build/entrypoints.json'
- 'public/build/manifest.json'

plugins:
- ./vendor/bref/bref
```

(you can preview that file [here](https://github.com/brefphp/bref/blob/master/template/http/serverless.yml))
You will also want to add `.serverless` to your `.gitignore`.

You still have a few modifications to do on the application to make it compatible with AWS Lambda.

Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
parameters:
level: 5
paths:
- bref
- src
- tests
excludePaths:
Expand Down
100 changes: 0 additions & 100 deletions src/Cli/init.php

This file was deleted.

7 changes: 0 additions & 7 deletions template/function/index.php

This file was deleted.

Loading
Loading