From b3f9eae645ddc3860f002520987e1facc5f5906f Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Mon, 10 Jun 2024 09:01:18 +0100 Subject: [PATCH] Widen composer compatibility to include Laravel 11 --- .github/workflows/validate-composer.yml | 13 ++++++++++--- README.md | 24 ++++++++++++++++++++++++ composer.json | 10 +++++----- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/.github/workflows/validate-composer.yml b/.github/workflows/validate-composer.yml index b6b7782..8c87cd4 100644 --- a/.github/workflows/validate-composer.yml +++ b/.github/workflows/validate-composer.yml @@ -18,6 +18,7 @@ jobs: - "8.*" - "9.*" - "10.*" + - "11.*" php-version: - "7.2" - "7.3" @@ -27,7 +28,7 @@ jobs: - "8.2" - "8.3" exclude: - # See - https://laravel.com/docs/9.x/releases#support-policy + # See - https://laravel.com/docs/11.x/releases#support-policy # See - https://github.com/laravel/framework/issues/40339 # Laravel 5.5 supports PHP 7.1 - 7.4 - {laravel-version: "5.5.*", php-version: "8.0"} # Laravel 5.5.* does not support PHP 8.0+ @@ -51,13 +52,19 @@ jobs: - {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+ - {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+ - {laravel-version: "9.*", php-version: "8.3"} # Laravel 9 does not support PHP 8.3+ - # Laravel 10 supports PHP 8.1 - 8.2 @todo tbc + # Laravel 10 supports PHP 8.1 - 8.3 - {laravel-version: "10.*", php-version: "7.2"} # Laravel 10 requires 8.1+ - {laravel-version: "10.*", php-version: "7.3"} # Laravel 10 requires 8.1+ - {laravel-version: "10.*", php-version: "7.4"} # Laravel 10 requires 8.1+ - {laravel-version: "10.*", php-version: "8.0"} # Laravel 10 requires 8.1+ + # Laravel 11 supports PHP 8.2 - 8.3 + - {laravel-version: "11.*", php-version: "7.2"} # Laravel 11 requires 8.2+ + - {laravel-version: "11.*", php-version: "7.3"} # Laravel 11 requires 8.2+ + - {laravel-version: "11.*", php-version: "7.4"} # Laravel 11 requires 8.2+ + - {laravel-version: "11.*", php-version: "8.0"} # Laravel 11 requires 8.2+ + - {laravel-version: "11.*", php-version: "8.1"} # Laravel 11 requires 8.2+ steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install PHP" uses: shivammathur/setup-php@v2 with: diff --git a/README.md b/README.md index 6109c62..e15ca71 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,30 @@ $config[\Scoutapm\Config\ConfigKey::LOG_LEVEL] = \Psr\Log\LogLevel::ERROR; Any of the constants defined in `\Psr\Log\LogLevel` are acceptable values for this configuration option. +### Laravel 11 Error Handling + +In Laravel 11, the `App\Exceptions\Handler` approach has been retired, and a new method `withExceptions()` has been +added in `bootstrap/app.php` when configuring the application. In order for Scout APM Error Handling to pick up +uncaught exceptions, you should add the appropriate Scout APM call, for example: + +```php +return Application::configure(basePath: dirname(__DIR__)) + ->withRouting( + web: __DIR__.'/../routes/web.php', + commands: __DIR__.'/../routes/console.php', + health: '/up', + ) + ->withMiddleware(function (Middleware $middleware) { + // ... + }) + ->withExceptions(function (Exceptions $exceptions) { + // Add the following call to enable uncaught exceptions in Scout APM error reporting: + $exceptions->reportable(function (Throwable $e) { + app()->make(\Scoutapm\ScoutApmAgent::class)->recordThrowable($e); + }); + })->create(); +``` + ## Documentation For full installation and troubleshooting documentation, visit our [help site](https://docs.scoutapm.com/#laravel). diff --git a/composer.json b/composer.json index e0a1524..e2e4bd1 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,11 @@ "development" ], "require": { - "illuminate/contracts": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/http": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/routing": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/support": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/view": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/contracts": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/http": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/routing": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/support": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/view": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "scoutapp/scout-apm-php": "^8.0" }, "config": {