Skip to content

Commit 3a4ccee

Browse files
authored
Laravel 11 (#23)
* Update packages and tests * Fix styling * wip * wip --------- Co-authored-by: Baspa <Baspa@users.noreply.github.com>
1 parent bbec367 commit 3a4ccee

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

.github/workflows/run-tests.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
php: [8.1]
17-
laravel: [9.*]
16+
php: [8.1, 8.2]
17+
laravel: [10.*, 11.*]
1818
stability: [prefer-lowest, prefer-stable]
1919
include:
20-
- laravel: 9.*
21-
testbench: 7.*
20+
- laravel: 10.*
21+
testbench: 8.*
22+
carbon: ^2.67
23+
- laravel: 11.*
24+
testbench: 9.*
25+
carbon: ^2.72.2
26+
exclude:
27+
- laravel: 11.*
28+
php: 8.1
2229

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

@@ -40,8 +47,8 @@ jobs:
4047
4148
- name: Install dependencies
4249
run: |
43-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
50+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
4451
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4552
4653
- name: Execute tests
47-
run: vendor/bin/pest
54+
run: vendor/bin/pest --ci

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@
1313
],
1414
"require": {
1515
"php": "^8.1",
16-
"illuminate/contracts": "^9.0|^10.0",
16+
"illuminate/contracts": "^9.0|^10.0|^11.0",
1717
"spatie/browsershot": "^3.0|^4.0",
1818
"spatie/laravel-package-tools": "^1.14"
1919
},
2020
"require-dev": {
2121
"laravel/pint": "^1.0",
22-
"nunomaduro/collision": "^7.0",
22+
"nunomaduro/collision": "^7.0|^8.0",
2323
"nunomaduro/larastan": "^2.0.1",
24-
"orchestra/testbench": "^8.0",
25-
"pestphp/pest": "^2.30",
24+
"orchestra/testbench": "^8.0|^9.0",
25+
"pestphp/pest": "^2.34",
2626
"pestphp/pest-plugin-laravel": "^2.2",
2727
"phpstan/extension-installer": "^1.1",
2828
"phpstan/phpstan": "^1.11",
2929
"phpstan/phpstan-deprecation-rules": "^1.0",
3030
"phpstan/phpstan-phpunit": "^1.0",
31-
"phpunit/phpunit": "^10.0",
32-
"spatie/laravel-ray": "^1.26"
31+
"phpunit/phpunit": "^10.0"
3332
},
3433
"autoload": {
3534
"psr-4": {

src/Http/Controllers/LaravelOpenGraphImageController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct()
3737

3838
public function __invoke(Request $request)
3939
{
40-
if (!app()->environment('local') && !$request->hasValidSignature()) {
40+
if (! app()->environment('local') && ! $request->hasValidSignature()) {
4141
abort(403);
4242
}
4343

@@ -48,7 +48,7 @@ public function __invoke(Request $request)
4848
return $html;
4949
}
5050

51-
if (!$this->getStorageFileExists($request->signature)) {
51+
if (! $this->getStorageFileExists($request->signature)) {
5252
$this->saveOpenGraphImage($html, $request->signature);
5353
}
5454

@@ -67,12 +67,12 @@ public function getStoragePath()
6767

6868
public function getStorageFileName($signature)
6969
{
70-
return $signature . '.' . $this->imageExtension;
70+
return $signature.'.'.$this->imageExtension;
7171
}
7272

7373
public function getStorageFilePath($filename)
7474
{
75-
return $this->getStoragePath() . '/' . $this->getStorageFileName($filename);
75+
return $this->getStoragePath().'/'.$this->getStorageFileName($filename);
7676
}
7777

7878
public function getStorageFileData($filename)
@@ -97,7 +97,7 @@ public function getImageType()
9797

9898
public function ensureDirectoryExists()
9999
{
100-
if (!File::isDirectory($this->getStoragePath())) {
100+
if (! File::isDirectory($this->getStoragePath())) {
101101
File::makeDirectory($this->getStoragePath(), 0777, true);
102102
}
103103
}
@@ -135,7 +135,7 @@ public function saveOpenGraphImage($html, $filename)
135135
public function getOpenGraphImageResponse($filename)
136136
{
137137
return response($this->getStorageFileData($filename), 200, [
138-
'Content-Type' => 'image/' . $this->getImageType(),
138+
'Content-Type' => 'image/'.$this->getImageType(),
139139
]);
140140
}
141141
}

0 commit comments

Comments
 (0)