Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ name: run-tests

on:
push:
branches: [ main ]
branches:
- main
pull_request:
branches: [ main ]
branches:
- main

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
max-parallel: 1
matrix:
os: [ ubuntu-latest, windows-latest ]
php: [ 8.2, 8.3 ]
laravel: [ 11.* ]
stability: [ prefer-lowest, prefer-stable ]
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.3]
laravel: ['11.*', '12.*']
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: 10.*

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

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
"require": {
"php": "^8.2|^8.3",
"guzzlehttp/guzzle": "^7.8",
"illuminate/support": "^11.0",
"illuminate/support": "^11.0|^12.0",
"symfony/psr-http-message-bridge": "^7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.50",
"orchestra/testbench": "^9.0",
"phpunit/phpunit": "^10.5"
"orchestra/testbench": "^9.0|^10.0",
"phpunit/phpunit": "^10.5|^11.5.3"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 7 additions & 7 deletions src/PrerenderMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct(Guzzle $client)
$guzzleConfig = $client->getConfig();
$guzzleConfig['timeout'] = config('prerender.timeout');

if (!$this->returnSoftHttpCodes) {
if (! $this->returnSoftHttpCodes) {
$guzzleConfig['allow_redirects'] = false;
}

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

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

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

$isRequestingPrerenderedPage = false;

if (!$userAgent) {
if (! $userAgent) {
return false;
}

if (!$request->isMethod('GET')) {
if (! $request->isMethod('GET')) {
return false;
}

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

if (!$isRequestingPrerenderedPage) {
if (! $isRequestingPrerenderedPage) {
return false;
}

// only check whitelist if it is not empty
if ($this->whitelist) {
if (!$this->isListed($requestUri, $this->whitelist)) {
if (! $this->isListed($requestUri, $this->whitelist)) {
return false;
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ private function getPrerenderedPageResponse(Request $request): ?ResponseInterfac

return $this->client->get($this->prerenderUri.'/'.urlencode($url), compact('headers'));
} catch (RequestException $exception) {
if (!$this->returnSoftHttpCodes && !empty($exception->getResponse()) && $exception->getResponse()->getStatusCode() === 404) {
if (! $this->returnSoftHttpCodes && ! empty($exception->getResponse()) && $exception->getResponse()->getStatusCode() === 404) {
abort(404);
}
} catch (ConnectException $exception) {
Expand Down