Skip to content

Commit

Permalink
Merge pull request #256 from scoutapp/add-laravel-9-support
Browse files Browse the repository at this point in the history
Add Laravel/Lumen 9 and Symfony 6 support
  • Loading branch information
asgrim authored Mar 8, 2022
2 parents cec3d6a + 13afe48 commit 43ee301
Show file tree
Hide file tree
Showing 13 changed files with 1,036 additions and 1,206 deletions.
41 changes: 41 additions & 0 deletions .github/fixtures/laravel9-exception-handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
$this->container->make(\Scoutapm\ScoutApmAgent::class)->recordThrowable($e);
});
}
}
53 changes: 47 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,16 @@ jobs:
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "8.0"
php-version: "7.1"
tools: composer:v2.2
env:
fail-fast: true
- name: "Replace guzzlehttp/guzzle with php-http/guzzle6-adapter (PHP 7.1)"
run: |
composer remove --dev guzzlehttp/guzzle --no-update --no-interaction
composer require --dev php-http/guzzle6-adapter --no-update --no-interaction
- name: "Install dependencies"
run: "composer install"
run: "composer update --no-interaction --prefer-dist --prefer-stable"
- name: "Run Psalm"
run: "vendor/bin/psalm"

Expand All @@ -133,7 +137,7 @@ jobs:
- name: "Composer update with new requirements"
run: "composer update --no-interaction --prefer-dist --prefer-stable"
- name: "Check for BC breaks"
run: ".github/workflows/roave-backwards-compatibility-check.sh"
run: ".github/workflows/roave-backwards-compatibility-check.sh --install-development-dependencies --from=origin/${{ github.base_ref }}"

###############################################################################
################################### SYMFONY ###################################
Expand All @@ -152,6 +156,7 @@ jobs:
symfony-version:
- "4.*"
- "5.*"
- "6.*"
php-version:
- "7.1"
- "7.2"
Expand All @@ -160,9 +165,12 @@ jobs:
- "8.0"
- "8.1"
exclude:
- { php-version: "7.1", symfony-version: "5.*", "twig-version": "2.*" } # Symfony 5 (with Twig 2) requires 7.2+
- { php-version: "7.1", symfony-version: "5.*", "twig-version": "3.*" } # Symfony 5 (with Twig 3) requires 7.2+
- { php-version: "7.1", symfony-version: "4.*", "twig-version": "3.*" } # Twig 3 (on Symfony 4) requires 7.2+
- { symfony-version: "4.*", "twig-version": "3.*", php-version: "7.1" } # Twig 3 (on Symfony 4) requires 7.2+
- { symfony-version: "5.*", php-version: "7.1" } # Symfony 5 requires 7.2+
- { symfony-version: "6.*", php-version: "7.1" } # Symfony 6 requires 8.0+
- { symfony-version: "6.*", php-version: "7.2" } # Symfony 6 requires 8.0+
- { symfony-version: "6.*", php-version: "7.3" } # Symfony 6 requires 8.0+
- { symfony-version: "6.*", php-version: "7.4" } # Symfony 6 requires 8.0+
steps:
- uses: actions/checkout@v2
- name: "Install PHP"
Expand Down Expand Up @@ -207,6 +215,7 @@ jobs:
- "6.*"
- "7.*"
- "8.*"
- "9.*"
php-version:
- "7.1"
- "7.2"
Expand All @@ -229,6 +238,11 @@ jobs:
# Laravel 8 supports PHP 7.3 - 8.1
- {laravel-version: "8.*", php-version: "7.1"} # Laravel 8 requires 7.3+
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+
# Laravel 9 supports PHP 7.3 - 8.1
- {laravel-version: "9.*", php-version: "7.1"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+
steps:
- uses: actions/checkout@v2
- name: "Install PHP"
Expand Down Expand Up @@ -269,6 +283,7 @@ jobs:
- "6.*"
- "7.*"
- "8.*"
- "9.*"
php-version:
- "7.1"
- "7.2"
Expand All @@ -291,6 +306,11 @@ jobs:
# Laravel 8 supports PHP 7.3 - 8.1
- {laravel-version: "8.*", php-version: "7.1"} # Laravel 8 requires 7.3+
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+
# Laravel 9 supports PHP 7.3 - 8.1
- {laravel-version: "9.*", php-version: "7.1"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
Expand All @@ -308,6 +328,9 @@ jobs:
fail-fast: true
- name: "Install Laravel quickstart project"
run: "composer create-project laravel/laravel:${{ matrix.laravel-version}} test-app --prefer-dist"
# We do not support psr/simple-cache 3.0.0 yet (https://github.com/scoutapp/scout-apm-php/issues/258)
- name: "Require psr/simple-cache:^1.0"
run: cd test-app && composer require psr/simple-cache:^1.0
- name: "Add scout-apm-php as a repository"
run: cd test-app && composer config repositories.scout path ../scout-apm-php
- name: "Require scout-apm-php current checkout (PHP 7.2+)"
Expand All @@ -327,6 +350,9 @@ jobs:
- name: "Configure error handler (Laravel 8)"
if: ${{ matrix.laravel-version == '8.*' }}
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel8-exception-handler.php app/Exceptions/Handler.php
- name: "Configure error handler (Laravel 9)"
if: ${{ matrix.laravel-version == '9.*' }}
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel9-exception-handler.php app/Exceptions/Handler.php
- name: "Add route to trigger error"
run: cd test-app && echo -e "Route::get('/e', function () { throw new \RuntimeException('fail'); });" >> routes/web.php
- name: "Configure Scout"
Expand Down Expand Up @@ -374,6 +400,7 @@ jobs:
- "6.*"
- "7.*"
- "8.*"
- "9.*"
php-version:
- "7.1"
- "7.2"
Expand All @@ -397,6 +424,11 @@ jobs:
# Lumen 8 supports PHP 7.3 - 8.1
- {lumen-version: "8.*", php-version: "7.1"} # Lumen 8 requires 7.3+
- {lumen-version: "8.*", php-version: "7.2"} # Lumen 8 requires 7.3+
# Lumen 9 supports PHP 7.3 - 8.1
- {lumen-version: "9.*", php-version: "7.1"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.2"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+
steps:
- uses: actions/checkout@v2
- name: "Install PHP"
Expand Down Expand Up @@ -437,6 +469,7 @@ jobs:
- "6.*"
- "7.*"
- "8.*"
- "9.*"
php-version:
- "7.1"
- "7.2"
Expand All @@ -460,6 +493,11 @@ jobs:
# Lumen 8 supports PHP 7.3 - 8.1
- {lumen-version: "8.*", php-version: "7.1"} # Lumen 8 requires 7.3+
- {lumen-version: "8.*", php-version: "7.2"} # Lumen 8 requires 7.3+
# Lumen 9 supports PHP 7.3 - 8.1
- {lumen-version: "9.*", php-version: "7.1"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.2"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
Expand All @@ -477,6 +515,9 @@ jobs:
fail-fast: true
- name: "Install Lumen quickstart project"
run: "composer create-project laravel/lumen:${{ matrix.lumen-version}} test-app --prefer-dist"
# We do not support psr/simple-cache 3.0.0 yet (https://github.com/scoutapp/scout-apm-php/issues/258)
- name: "Require psr/simple-cache:^1.0"
run: cd test-app && composer require psr/simple-cache:^1.0
- name: "Add scout-apm-php as a repository"
run: cd test-app && composer config repositories.scout path ../scout-apm-php
- name: "Require scout-apm-php current checkout (PHP 7.2+)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/roave-backwards-compatibility-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cd "$(dirname "$0")/../.." || exit 2
echo "Running BC check, please wait..."

# Capture output to variable AND print it
OUTPUT=$(vendor/bin/roave-backward-compatibility-check --format=markdown --install-development-dependencies 2>&1)
OUTPUT=$(vendor/bin/roave-backward-compatibility-check --format=markdown "$@" 2>&1)

# Remove rows we want to suppress
OUTPUT=`echo "$OUTPUT" | sed '/Roave\\\BetterReflection\\\Reflection\\\ReflectionClass "Symfony\\\Component\\\HttpKernel\\\Event\\\FilterControllerEvent" could not be found in the located source/'d`
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
"cache/array-adapter": "^1.1",
"doctrine/coding-standard": "^8.2",
"guzzlehttp/guzzle": "^7.3",
"laravel/framework": "^5.5.0|^6.0|^7.0|^8.0",
"laravel/lumen-framework": "^5.5.0|^6.0|^7.0|^8.0",
"laravel/framework": "^5.5.0|^6.0|^7.0|^8.0|^9.0",
"laravel/lumen-framework": "^5.5.0|^6.0|^7.0|^8.0|^9.0",
"monolog/monolog": "^1.26|^2.2.0",
"phpunit/phpunit": "^7.5.20|^8.5.22|^9.5.2",
"nyholm/psr7": "^1.4",
"psalm/plugin-phpunit": "^0.15.1",
"symfony/config": "^4.0 || ^5.0",
"symfony/dependency-injection": "^4.0 || ^5.0",
"symfony/event-dispatcher": "^4.0 || ^5.0",
"symfony/http-kernel": "^4.0 || ^5.0",
"symfony/config": "^4.0 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.0 || ^5.0 || ^6.0",
"symfony/event-dispatcher": "^4.0 || ^5.0 || ^6.0",
"symfony/http-kernel": "^4.0 || ^5.0 || ^6.0",
"symfony/orm-pack": "^2.0",
"symfony/process": "^3.0 || ^4.0 || ^5.0",
"symfony/process": "^3.0 || ^4.0 || ^5.0 || ^6.0",
"symfony/twig-pack": "^1.0",
"vimeo/psalm": "^4.16"
},
Expand Down
Loading

0 comments on commit 43ee301

Please sign in to comment.