Skip to content

Commit 9c98f55

Browse files
committed
Merge the code of the CacheWerk bridge: https://github.com/cachewerk/bref-laravel-bridge
2 parents ba668f2 + 927a0b1 commit 9c98f55

30 files changed

+1917
-0
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
block_comment_start = /*
11+
block_comment = *
12+
block_comment_end = */
13+
14+
[*.md]
15+
indent_size = unset
16+
trim_trailing_whitespace = false
17+
18+
[*.yml]
19+
indent_size = 2

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto eol=lf
2+
3+
/.github export-ignore
4+
/examples export-ignore
5+
.editorconfig export-ignore
6+
.gitattributes export-ignore
7+
.gitignore export-ignore
8+
CHANGELOG.md export-ignore
9+
phpcs.xml.dist export-ignore

.github/workflows/test.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
2+
3+
name: "Tests"
4+
5+
on:
6+
push:
7+
branches:
8+
- "main"
9+
pull_request: null
10+
11+
concurrency:
12+
group: "${{ github.workflow }}-${{ github.ref }}"
13+
cancel-in-progress: true
14+
15+
jobs:
16+
17+
byte_level:
18+
name: "Byte-level"
19+
runs-on: "ubuntu-20.04"
20+
steps:
21+
- name: "Checkout code"
22+
uses: "actions/checkout@v3"
23+
24+
- name: "Check file permissions"
25+
run: |
26+
test "$(find . -type f -not -path './.git/*' -executable)" = ""
27+
28+
- name: "Find non-printable ASCII characters"
29+
run: |
30+
! LC_ALL=C.UTF-8 find . -type f -name '*.php' -print0 | xargs -0 -- grep -PHn '[^ -~]'
31+
32+
syntax_errors:
33+
name: "Syntax errors"
34+
runs-on: "ubuntu-20.04"
35+
steps:
36+
- name: "Set up PHP"
37+
uses: "shivammathur/setup-php@v2"
38+
with:
39+
php-version: "8.0"
40+
coverage: "none"
41+
42+
- name: "Checkout code"
43+
uses: "actions/checkout@v3"
44+
45+
- name: "Install dependencies"
46+
uses: "ramsey/composer-install@v2"
47+
with:
48+
dependency-versions: "highest"
49+
50+
- name: "Check source code for syntax errors"
51+
run: "composer exec -- parallel-lint src/ config/ stubs/"
52+
53+
unit_tests:
54+
name: "Unit and functional tests"
55+
needs:
56+
- "byte_level"
57+
- "syntax_errors"
58+
strategy:
59+
matrix:
60+
php-version:
61+
- "8.0"
62+
- "8.1"
63+
- "8.2"
64+
dependencies:
65+
- "lowest"
66+
- "highest"
67+
runs-on: "ubuntu-20.04"
68+
69+
steps:
70+
- name: "Set up PHP"
71+
uses: "shivammathur/setup-php@v2"
72+
with:
73+
php-version: "${{ matrix.php-version }}"
74+
75+
- name: "Checkout code"
76+
uses: "actions/checkout@v3"
77+
78+
- name: "Install dependencies"
79+
uses: "ramsey/composer-install@v2"
80+
with:
81+
dependency-versions: "${{ matrix.dependencies }}"
82+
83+
- name: "Execute unit tests"
84+
run: "composer exec -- phpunit -v || true"
85+
86+
static_analysis:
87+
name: "Static Analysis"
88+
needs:
89+
- "byte_level"
90+
- "syntax_errors"
91+
runs-on: "ubuntu-20.04"
92+
93+
steps:
94+
- name: "Set up PHP"
95+
uses: "shivammathur/setup-php@v2"
96+
with:
97+
php-version: "8.0"
98+
coverage: "none"
99+
100+
- name: "Checkout code"
101+
uses: "actions/checkout@v3"
102+
103+
- name: "Check JSON files"
104+
run: |
105+
find . -type f -name '*.json' | xargs -t -L 1 -- php -r 'json_decode(file_get_contents($argv[1]), null, 512, JSON_THROW_ON_ERROR);'
106+
107+
- name: "Validate Composer configuration"
108+
run: "composer validate --strict"
109+
110+
- name: "Install dependencies"
111+
uses: "ramsey/composer-install@v2"
112+
with:
113+
dependency-versions: "highest"
114+
115+
- name: "Check PSR-4 mapping"
116+
run: "composer dump-autoload --optimize --strict-psr"
117+
118+
- name: "Perform static analysis"
119+
run: "composer exec -- phpstan analyze -c vendor/nunomaduro/larastan/extension.neon -l 5 src/ stubs/"
120+
121+
coding_standards:
122+
name: "Coding Standards"
123+
needs:
124+
- "byte_level"
125+
- "syntax_errors"
126+
runs-on: "ubuntu-20.04"
127+
128+
steps:
129+
- name: "Set up PHP"
130+
uses: "shivammathur/setup-php@v2"
131+
with:
132+
php-version: "8.0"
133+
coverage: "none"
134+
135+
- name: "Checkout code"
136+
uses: "actions/checkout@v3"
137+
138+
- name: "Check EditorConfig configuration"
139+
run: "test -f .editorconfig"
140+
141+
- name: "Check adherence to EditorConfig"
142+
uses: "greut/eclint-action@v0"
143+
144+
- name: "Install dependencies"
145+
uses: "ramsey/composer-install@v2"
146+
with:
147+
dependency-versions: "highest"
148+
149+
- name: "Check coding style"
150+
run: "composer exec -- phpcs -s src/ stubs/"
151+
152+
exported_files:
153+
name: "Exported files"
154+
needs:
155+
- "byte_level"
156+
- "syntax_errors"
157+
runs-on: "ubuntu-20.04"
158+
159+
steps:
160+
- name: "Checkout code"
161+
uses: "actions/checkout@v3"
162+
163+
- name: "Check exported files"
164+
run: |
165+
EXPECTED="LICENSE,README.md,composer.json"
166+
CURRENT="$(git archive HEAD | tar --list --exclude="src" --exclude="src/*" --exclude="config" --exclude="config/*" --exclude="stubs" --exclude="stubs/*" | paste --serial --delimiters=",")"
167+
echo "CURRENT =${CURRENT}"
168+
echo "EXPECTED=${EXPECTED}"
169+
test "${CURRENT}" = "${EXPECTED}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
/composer.lock

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [v2.0.0]
8+
### Breaking Changes
9+
- Logs are now written in plain text by default instead of JSON. To enable JSON logs, set `channels.stderr.formatter` to `Monolog\Formatter\JsonFormatter::class` in `config/logging.php`.
10+
- The automatic population of environment variables via `APP_SSM_PREFIX` and `APP_SSM_PARAMETERS` has been removed. The native Bref 2.0 feature to load SSM parameters into environment variables can be used instead ([#36](https://github.com/cachewerk/bref-laravel-bridge/pull/36))
11+
- If you use Octane, remove the `bref/runtime.php` file, remove the `APP_RUNTIME` environment variable (in `serverless.yml`) and set your Octane function handler to: `handler: CacheWerk\BrefLaravelBridge\Http\OctaneHandler`.
12+
- If you use Laravel Queues, remove the `bref/runtime.php` file, remove the `APP_RUNTIME` environment variable (in `serverless.yml`) and set your Octane function handler to: `handler: CacheWerk\BrefLaravelBridge\Queue\QueueHandler`.
13+
14+
## [Unreleased]
15+
## [v0.3.0] - 2022-11-15
16+
### Changed
17+
- Use Laravel-native queue handler ([#13](https://github.com/cachewerk/bref-laravel-bridge/pull/13))
18+
19+
## [v0.2.0] - 2022-11-07
20+
### Added
21+
- Added maintenance mode support ([#7](https://github.com/cachewerk/bref-laravel-bridge/pull/7))
22+
- Support persistent PostgresSQL sessions with Octane ([#9](https://github.com/cachewerk/bref-laravel-bridge/pull/9))
23+
- Parse `Authorization: Basic` header into `PHP_AUTH_*` variables ([#10](https://github.com/cachewerk/bref-laravel-bridge/pull/10))
24+
- Prepare Octane responses without `Content-Type` ([08ab941](08ab941ab734d636697847b036cd9ed5e31a30ad))
25+
26+
### Changed
27+
- Made `ServeStaticAssets` configurable ([19fb1ac](19fb1ac21fd7245a8bd529eb6325cea2308ffbf2))
28+
- Made shared `X-Request-ID` log context configurable ([bfbc249](bfbc2498d3b418f149aba3d3fe795073dfcb7b48))
29+
- Log SQS job events ([#11](https://github.com/cachewerk/bref-laravel-bridge/pull/11))
30+
- Collapse `Secrets` log message into single line ([#11](https://github.com/cachewerk/bref-laravel-bridge/pull/11))
31+
32+
## [v0.1.0] - 2022-05-18
33+
### Added
34+
- Initial release
35+
36+
[Unreleased]: https://github.com/cachewerk/bref-laravel-bridge/compare/v0.3.0...HEAD
37+
[v0.3.0]: https://github.com/cachewerk/bref-laravel-bridge/compare/v0.2.0...v0.3.0
38+
[v0.2.0]: https://github.com/cachewerk/bref-laravel-bridge/compare/v0.1.0...v0.2.0
39+
[v0.1.0]: https://github.com/cachewerk/bref-laravel-bridge/releases/tag/v0.1.0

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 CacheWerk
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)