You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/default/getting-started.mdx
+28-17Lines changed: 28 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,33 +27,29 @@ Next, in an empty directory, install Bref using Composer:
27
27
composer require bref/bref
28
28
```
29
29
30
-
Make sure that the version of Bref that was installed is 1.0 or greater.
30
+
Make sure that the version of Bref that was installed is 3.0 or greater.
31
31
32
-
Then let's start by initializing a new project by running:
32
+
Then, create a `serverless.yml` file. This file will describe how to deploy your application.
33
33
34
-
```bash
35
-
vendor/bin/bref init
36
-
```
37
-
38
-
Accept all the defaults by pressing "Enter". The following files will be created in your project:
39
-
40
-
-`index.php` contains the code of your application
41
-
-`serverless.yml` contains the configuration for deploying on AWS
42
-
43
-
You are free to edit `index.php`.
34
+
```yml filename="serverless.yml"
35
+
service: app # your application name (lowercase without spaces)
44
36
45
-
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:
37
+
bref:
38
+
# Uncomment and set your team ID if you are using Bref Cloud
39
+
#team: bref-team-id
46
40
47
-
```yml filename="serverless.yml"
48
-
service: app
49
41
provider:
50
42
name: aws
51
-
region: us-east-1
43
+
region: us-east-1 # AWS region to deploy to
44
+
environment: # Environment variables
45
+
APP_ENV: prod
52
46
53
47
functions:
54
48
web:
49
+
# `index.php` is the entrypoint of your application
55
50
handler: index.php
56
-
runtime: php-81-fpm
51
+
runtime: php-84-fpm
52
+
timeout: 28# in seconds (API Gateway has a max timeout of 29 seconds)
57
53
events:
58
54
- httpApi: '*'
59
55
@@ -66,6 +62,21 @@ plugins:
66
62
- ./vendor/bref/bref
67
63
```
68
64
65
+
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`:
66
+
67
+
```yml
68
+
handler: public/index.php
69
+
```
70
+
71
+
If this is a new application, you can create a very simple `index.php` file to test things out, for example:
72
+
73
+
```php
74
+
<?php
75
+
echo 'Hello world!';
76
+
```
77
+
78
+
You will also want to add `.serverless` to your `.gitignore`.
0 commit comments