Skip to content

Commit

Permalink
Add Laravel 11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
maantje committed Apr 3, 2024
1 parent 33bf906 commit 495bd9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1]
laravel: [10.*]
php: [8.2]
laravel: [9.*, 10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
}
],
"require": {
"php": "^8.1",
"illuminate/contracts": "^10.0",
"php": "^8.0",
"illuminate/contracts": "^9.0|^10.0|^11.0",
"spatie/laravel-package-tools": "^1.14.0",
"spiral-packages/profiler": "^1.0"
},
Expand Down
7 changes: 6 additions & 1 deletion src/XhprofServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SpiralPackages\Profiler\Profiler;
use SpiralPackages\Profiler\Storage\WebStorage;
use Symfony\Component\HttpClient\NativeHttpClient;
use Throwable;

class XhprofServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -72,6 +73,10 @@ private function isEnabled(): bool
return filter_var(request()->header(XhprofProfiler::HEADER), FILTER_VALIDATE_BOOLEAN);
}

return config()->get('xhprof.enabled');
try {
return config()->get('xhprof.enabled');
} catch (Throwable) {
return false;
}
}
}
4 changes: 3 additions & 1 deletion src/middleware/XhprofProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public function __construct(private readonly Profiler $profiler)
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
* @param Request $request
* @param Closure(Request): (Response) $next
* @return Response
*/
public function handle(Request $request, Closure $next): Response
{
Expand Down

0 comments on commit 495bd9f

Please sign in to comment.