Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 5a4cdbc

Browse files
bref 8.1 fixes and other
1 parent cb74a02 commit 5a4cdbc

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

‎0.3-Replacing-The-HTTP-Web-Server-For-Traditional-PHP-Frameworks/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,20 @@ change to the correct directory:
3434
cd 0.3-Replacing-The-HTTP-Web-Server-For-Traditional-PHP-Frameworks
3535
```
3636

37-
Install [Bref](https://github.com/brefphp/bref) using Composer:
37+
Install [Bref](https://github.com/brefphp/bref) using either composer or docker;
38+
39+
1. Composer:
40+
41+
```bash
42+
composer require bref/bref
43+
```
44+
45+
2. Docker:
46+
47+
```bash
48+
docker run --rm --interactive --tty --volume $PWD:/app composer update
49+
```
3850

39-
```bash
40-
composer require bref/bref
41-
```
4251

4352
Deploy the stack: This command uses SAM CLI, but you could also deploy with the [serverless framework](https://www.serverless.com/):
4453

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"config": {
3+
"platform": {
4+
"php": "8.1"
5+
}
6+
},
7+
"require": {
8+
"bref/bref": "^1.5",
9+
"php": ">=8.1"
10+
}
11+
}

‎0.3-Replacing-The-HTTP-Web-Server-For-Traditional-PHP-Frameworks/template.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ Globals:
1010
Timeout: 3
1111

1212
Resources:
13+
##########################################################################
14+
# API Gateway with stage name #
15+
##########################################################################
16+
HttpApi:
17+
Type: AWS::Serverless::HttpApi
18+
Properties:
19+
StageName: dev
20+
1321
##########################################################################
1422
# S3 Bucket to store static assets #
1523
##########################################################################
1624
Assets:
1725
Type: AWS::S3::Bucket
1826
Properties:
19-
BucketName: php-example-assets-for-php-app-example-3
27+
BucketName: !Sub 'cf-origin-${AWS::AccountId}-${AWS::StackName}'
2028
# The policy that makes the bucket publicly readable
2129
AssetsBucketPolicy:
2230
Type: AWS::S3::BucketPolicy
@@ -52,16 +60,18 @@ Resources:
5260
Timeout: 30
5361
Tracing: Active
5462
Layers:
55-
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73-fpm:25'
63+
- !Sub'arn:aws:lambda:${AWS::Region}:209497400698:layer:php-81-fpm:19'
5664
Events:
5765
DynamicRequestsRoot:
5866
Type: HttpApi
5967
Properties:
68+
ApiId: !Ref HttpApi
6069
Path: /
6170
Method: ANY
6271
DynamicRequestsProxy:
6372
Type: HttpApi
6473
Properties:
74+
ApiId: !Ref HttpApi
6575
Path: /{proxy+}
6676
Method: ANY
6777
##########################################################################
@@ -74,15 +84,16 @@ Resources:
7484
Enabled: true
7585
Origins:
7686
- Id: Website
77-
DomainName: !Join ['.', [!Ref ServerlessHttpApi, 'execute-api', !Ref AWS::Region, 'amazonaws.com']]
87+
DomainName: !Sub '${HttpApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}'
7888
# This is the stage
7989
OriginPath: "/dev"
8090
CustomOriginConfig:
8191
OriginProtocolPolicy: 'https-only' # API Gateway only supports HTTPS
8292
# The assets (S3)
8393
- Id: Assets
8494
DomainName: !GetAtt Assets.RegionalDomainName
85-
S3OriginConfig: {} # this key is required to tell CloudFront that this is an S3 origin, even though nothing is configured
95+
S3OriginConfig:
96+
OriginAccessIdentity: !Sub 'origin-access-identity/cloudfront/${S3OriginIdentityExample}'
8697
# The default behavior is to send everything to AWS Lambda
8798
DefaultCacheBehavior:
8899
AllowedMethods: [GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /