Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 95e1510

Browse files
Laravel 12.x Compatibility (#43)
* Bump dependencies for Laravel 12 * Update GitHub Actions for Laravel 12 * Fix styling --------- Co-authored-by: laravel-shift <[email protected]>
1 parent 2ef203c commit 95e1510

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

.github/workflows/run-tests.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@ name: run-tests
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [ main ]
8+
branches:
9+
- main
810

911
jobs:
1012
test:
1113
runs-on: ${{ matrix.os }}
14+
1215
strategy:
1316
fail-fast: true
1417
max-parallel: 1
1518
matrix:
16-
os: [ ubuntu-latest, windows-latest ]
17-
php: [ 8.2, 8.3 ]
18-
laravel: [ 11.* ]
19-
stability: [ prefer-lowest, prefer-stable ]
19+
os: [ubuntu-latest, windows-latest]
20+
php: [8.2, 8.3]
21+
laravel: ['11.*', '12.*']
22+
stability: [prefer-lowest, prefer-stable]
2023
include:
2124
- laravel: 11.*
2225
testbench: 9.*
26+
- laravel: 12.*
27+
testbench: 10.*
2328

2429
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2530

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
"require": {
3131
"php": "^8.2|^8.3",
3232
"guzzlehttp/guzzle": "^7.8",
33-
"illuminate/support": "^11.0",
33+
"illuminate/support": "^11.0|^12.0",
3434
"symfony/psr-http-message-bridge": "^7.0"
3535
},
3636
"require-dev": {
3737
"friendsofphp/php-cs-fixer": "^3.50",
38-
"orchestra/testbench": "^9.0",
39-
"phpunit/phpunit": "^10.5"
38+
"orchestra/testbench": "^9.0|^10.0",
39+
"phpunit/phpunit": "^10.5|^11.5.3"
4040
},
4141
"autoload": {
4242
"psr-4": {

src/PrerenderMiddleware.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct(Guzzle $client)
8282
$guzzleConfig = $client->getConfig();
8383
$guzzleConfig['timeout'] = config('prerender.timeout');
8484

85-
if (!$this->returnSoftHttpCodes) {
85+
if (! $this->returnSoftHttpCodes) {
8686
$guzzleConfig['allow_redirects'] = false;
8787
}
8888

@@ -111,7 +111,7 @@ public function handle(Request $request, Closure $next)
111111
if ($prerenderedResponse) {
112112
$statusCode = $prerenderedResponse->getStatusCode();
113113

114-
if (!$this->returnSoftHttpCodes && $statusCode >= 300 && $statusCode < 400) {
114+
if (! $this->returnSoftHttpCodes && $statusCode >= 300 && $statusCode < 400) {
115115
$headers = $prerenderedResponse->getHeaders();
116116

117117
return Redirect::to(array_change_key_case($headers, CASE_LOWER)['location'][0], $statusCode);
@@ -137,11 +137,11 @@ private function shouldShowPrerenderedPage(Request $request): bool
137137

138138
$isRequestingPrerenderedPage = false;
139139

140-
if (!$userAgent) {
140+
if (! $userAgent) {
141141
return false;
142142
}
143143

144-
if (!$request->isMethod('GET')) {
144+
if (! $request->isMethod('GET')) {
145145
return false;
146146
}
147147

@@ -161,13 +161,13 @@ private function shouldShowPrerenderedPage(Request $request): bool
161161
$isRequestingPrerenderedPage = true;
162162
}
163163

164-
if (!$isRequestingPrerenderedPage) {
164+
if (! $isRequestingPrerenderedPage) {
165165
return false;
166166
}
167167

168168
// only check whitelist if it is not empty
169169
if ($this->whitelist) {
170-
if (!$this->isListed($requestUri, $this->whitelist)) {
170+
if (! $this->isListed($requestUri, $this->whitelist)) {
171171
return false;
172172
}
173173
}
@@ -208,7 +208,7 @@ private function getPrerenderedPageResponse(Request $request): ?ResponseInterfac
208208

209209
return $this->client->get($this->prerenderUri.'/'.urlencode($url), compact('headers'));
210210
} catch (RequestException $exception) {
211-
if (!$this->returnSoftHttpCodes && !empty($exception->getResponse()) && $exception->getResponse()->getStatusCode() === 404) {
211+
if (! $this->returnSoftHttpCodes && ! empty($exception->getResponse()) && $exception->getResponse()->getStatusCode() === 404) {
212212
abort(404);
213213
}
214214
} catch (ConnectException $exception) {

0 commit comments

Comments
 (0)