Skip to content

Commit b5f759d

Browse files
authored
Merge pull request #2030 from brefphp/delete-bref-cli
Delete the `bref` CLI (Bref v3)
2 parents b253d14 + a38f487 commit b5f759d

File tree

13 files changed

+73
-402
lines changed

13 files changed

+73
-402
lines changed

.phpcs.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<!-- Show sniff names -->
88
<arg value="s"/>
99

10-
<file>bref</file>
1110
<file>src</file>
1211
<file>tests</file>
1312

bref

Lines changed: 0 additions & 132 deletions
This file was deleted.

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
}
1717
},
1818
"bin": [
19-
"bref",
2019
"src/bref-local"
2120
],
2221
"require": {

docs/default/getting-started.mdx

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,29 @@ Next, in an empty directory, install Bref using Composer:
2727
composer require bref/bref
2828
```
2929

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.
3131

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.
3333

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)
4436

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
4640

47-
```yml filename="serverless.yml"
48-
service: app
4941
provider:
5042
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
5246

5347
functions:
5448
web:
49+
# `index.php` is the entrypoint of your application
5550
handler: index.php
5651
runtime: php-84-fpm
52+
timeout: 28 # in seconds (API Gateway has a max timeout of 29 seconds)
5753
events:
5854
- httpApi: '*'
5955

@@ -66,6 +62,21 @@ plugins:
6662
- ./vendor/bref/bref
6763
```
6864
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`.
79+
6980
## Deployment
7081

7182
To deploy, run:

docs/symfony/getting-started.mdx

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,54 @@ Next, in an existing Symfony project, install Bref and the [Symfony Bridge packa
2121
composer require bref/bref bref/symfony-bridge --update-with-dependencies
2222
```
2323

24-
Next, create a `serverless.yml` configuration file at the root of your project by running:
25-
26-
```bash
27-
vendor/bin/bref init symfony
24+
Next, create a `serverless.yml` configuration file at the root of your project:
25+
26+
```yml filename="serverless.yml"
27+
service: app # your application name (lowercase without spaces)
28+
29+
bref:
30+
# Uncomment and set your team ID if you are using Bref Cloud
31+
#team: bref-team-id
32+
33+
provider:
34+
name: aws
35+
region: us-east-1 # AWS region to deploy to
36+
environment: # Environment variables
37+
APP_ENV: prod
38+
39+
functions:
40+
# This function runs the Symfony website/API
41+
web:
42+
handler: public/index.php
43+
runtime: php-84-fpm
44+
timeout: 28 # in seconds (API Gateway has a max timeout of 29 seconds)
45+
events:
46+
- httpApi: '*'
47+
# This function let us run console commands in Lambda
48+
console:
49+
handler: bin/console
50+
runtime: php-84-console
51+
timeout: 120 # in seconds
52+
53+
package:
54+
patterns:
55+
# Excluded files and folders for deployment
56+
- '!assets/**'
57+
- '!node_modules/**'
58+
- '!public/build/**'
59+
- '!tests/**'
60+
- '!var/**'
61+
# If you want to include files and folders that are part of excluded folders,
62+
# add them at the end
63+
- 'var/cache/prod/**'
64+
- 'public/build/entrypoints.json'
65+
- 'public/build/manifest.json'
66+
67+
plugins:
68+
- ./vendor/bref/bref
2869
```
2970
30-
(you can preview that file [here](https://github.com/brefphp/bref/blob/master/template/http/serverless.yml))
71+
You will also want to add `.serverless` to your `.gitignore`.
3172

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

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
parameters:
22
level: 5
33
paths:
4-
- bref
54
- src
65
- tests
76
excludePaths:

src/Cli/init.php

Lines changed: 0 additions & 100 deletions
This file was deleted.

template/function/index.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)