Skip to content

Commit

Permalink
Laravel 11 (#23)
Browse files Browse the repository at this point in the history
* Update packages and tests

* Fix styling

* wip

* wip

---------

Co-authored-by: Baspa <[email protected]>
  • Loading branch information
Baspa and Baspa authored Mar 7, 2024
1 parent bbec367 commit 3a4ccee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1]
laravel: [9.*]
php: [8.1, 8.2]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
carbon: ^2.67
- laravel: 11.*
testbench: 9.*
carbon: ^2.72.2
exclude:
- laravel: 11.*
php: 8.1

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

Expand All @@ -40,8 +47,8 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/pest
run: vendor/bin/pest --ci
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@
],
"require": {
"php": "^8.1",
"illuminate/contracts": "^9.0|^10.0",
"illuminate/contracts": "^9.0|^10.0|^11.0",
"spatie/browsershot": "^3.0|^4.0",
"spatie/laravel-package-tools": "^1.14"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.0",
"nunomaduro/collision": "^7.0|^8.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.30",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-laravel": "^2.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ray": "^1.26"
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 6 additions & 6 deletions src/Http/Controllers/LaravelOpenGraphImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct()

public function __invoke(Request $request)
{
if (!app()->environment('local') && !$request->hasValidSignature()) {
if (! app()->environment('local') && ! $request->hasValidSignature()) {
abort(403);
}

Expand All @@ -48,7 +48,7 @@ public function __invoke(Request $request)
return $html;
}

if (!$this->getStorageFileExists($request->signature)) {
if (! $this->getStorageFileExists($request->signature)) {
$this->saveOpenGraphImage($html, $request->signature);
}

Expand All @@ -67,12 +67,12 @@ public function getStoragePath()

public function getStorageFileName($signature)
{
return $signature . '.' . $this->imageExtension;
return $signature.'.'.$this->imageExtension;
}

public function getStorageFilePath($filename)
{
return $this->getStoragePath() . '/' . $this->getStorageFileName($filename);
return $this->getStoragePath().'/'.$this->getStorageFileName($filename);
}

public function getStorageFileData($filename)
Expand All @@ -97,7 +97,7 @@ public function getImageType()

public function ensureDirectoryExists()
{
if (!File::isDirectory($this->getStoragePath())) {
if (! File::isDirectory($this->getStoragePath())) {
File::makeDirectory($this->getStoragePath(), 0777, true);
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public function saveOpenGraphImage($html, $filename)
public function getOpenGraphImageResponse($filename)
{
return response($this->getStorageFileData($filename), 200, [
'Content-Type' => 'image/' . $this->getImageType(),
'Content-Type' => 'image/'.$this->getImageType(),
]);
}
}

0 comments on commit 3a4ccee

Please sign in to comment.