Skip to content

Commit

Permalink
Merge pull request #312 from scoutapp/laravel-11-support
Browse files Browse the repository at this point in the history
Laravel 11 support
  • Loading branch information
asgrim authored Jun 10, 2024
2 parents 3e035f1 + 9472615 commit c5213df
Show file tree
Hide file tree
Showing 13 changed files with 2,746 additions and 1,738 deletions.
20 changes: 20 additions & 0 deletions .github/fixtures/laravel11-app-with-exceptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

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) {
$exceptions->reportable(function (Throwable $e) {
app()->make(\Scoutapm\ScoutApmAgent::class)->recordThrowable($e);
});
})->create();
92 changes: 59 additions & 33 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -116,8 +116,8 @@ jobs:
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- uses: Vampire/setup-wsl@v2
- uses: actions/checkout@v4
- uses: Vampire/setup-wsl@v3
if: ${{ matrix.os == 'windows-latest' }}
- name: "Install PHP"
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -230,13 +230,14 @@ jobs:
name: "Check coding standards"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "7.2"
tools: composer:v2.3
php-version: "7.4"
extensions: mongodb
tools: composer:v2.6
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -249,26 +250,27 @@ jobs:
name: "Perform static analysis"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "7.2"
tools: composer:v2.3
php-version: "7.4"
extensions: mongodb
tools: composer:v2.6
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Install dependencies"
run: "composer install --no-interaction --prefer-dist"
- name: "Run Psalm"
run: "vendor/bin/psalm"
run: "vendor/bin/psalm --no-cache --threads=1"

roave-backwards-compatibility-check:
name: "Check for Backward Compatibility breaks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Install PHP"
Expand Down Expand Up @@ -318,7 +320,7 @@ jobs:
- { 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@v3
- uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -359,16 +361,17 @@ jobs:
- "8.*"
- "9.*"
- "10.*"
- "11.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.3
- "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+
Expand All @@ -392,13 +395,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:
Expand All @@ -419,7 +428,7 @@ jobs:
if: ${{ (matrix.php-version == '8.0' || matrix.php-version == '8.1') && (matrix.laravel-version == '8.*' || matrix.laravel-version == '9.*') }}
run: "composer require --dev spatie/laravel-ignition:^1.6 --no-update --no-interaction"
- name: "Install spatie/laravel-ignition ^2.0 (if available)"
if: ${{ (matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3') && (matrix.laravel-version == '10.*') }}
if: ${{ (matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3') && (matrix.laravel-version == '10.*' || matrix.laravel-version == '11.*') }}
run: "composer require --dev spatie/laravel-ignition:^2.0 --no-update --no-interaction"
- name: "Unrestrict nesbot/carbon for older PHP versions"
if: ${{ (matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1') }}
Expand All @@ -445,16 +454,17 @@ jobs:
- "8.*"
- "9.*"
- "10.*"
- "11.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.3
- "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+
Expand All @@ -478,15 +488,21 @@ 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+
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: scout-apm-php
- name: "Install PHP"
Expand Down Expand Up @@ -520,9 +536,12 @@ 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)"
- name: "Configure error handler (Laravel 9-10)"
if: matrix.laravel-version == '9.*' || matrix.laravel-version == '10.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel9-exception-handler.php app/Exceptions/Handler.php
- name: "Configure error handler (Laravel 11)"
if: matrix.laravel-version == '11.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel11-app-with-exceptions.php bootstrap/app.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 @@ -572,16 +591,17 @@ jobs:
- "8.*"
- "9.*"
- "10.*"
- "11.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 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+
Expand All @@ -605,15 +625,21 @@ 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+
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: scout-apm-php
- name: "Install PHP"
Expand Down Expand Up @@ -677,7 +703,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2
- "8.3"
exclude:
# Lumen 5.5 supports PHP 7.1 - 7.3
- {lumen-version: "5.5.*", php-version: "7.4"} # Lumen 5.5 does not support PHP 7.4+
Expand All @@ -704,13 +730,13 @@ jobs:
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "8.3"} # Lumen 9 does not support PHP 8.3+
# Lumen 10 supports PHP 8.1 - 8.2 @todo tbc
# Lumen 10 supports PHP 8.1 - 8.3
- {lumen-version: "10.*", php-version: "7.2"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.3"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.4"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "8.0"} # Lumen 10 requires 8.1+
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -758,7 +784,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2
- "8.3"
exclude:
# Lumen 5.5 supports PHP 7.1 - 7.3
- {lumen-version: "5.5.*", php-version: "7.4"} # Lumen 5.5 does not support PHP 7.4+
Expand All @@ -785,7 +811,7 @@ jobs:
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "8.3"} # Lumen 9 does not support PHP 8.3+
# Lumen 10 supports PHP 8.1 - 8.2 @todo tbc
# Lumen 10 supports PHP 8.1 - 8.3
- {lumen-version: "10.*", php-version: "7.2"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.3"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.4"} # Lumen 10 requires 8.1+
Expand All @@ -795,7 +821,7 @@ jobs:
steps:
- name: "Skip if SCOUT_APM_KEY secret is not available"
run: echo 'This job is skipped entirely as it needs SCOUT_APM_KEY set in secrets.'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: scout-apm-php
- name: "Install PHP"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Release"
uses: "laminas/automatic-releases@v1"
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: *

PHP_VERSION=7.2
PHP_VERSION=7.4
PHP_PATH=/usr/bin/env php$(PHP_VERSION)
COMPOSER_PATH=/usr/local/bin/composer
OPTS=
Expand All @@ -20,7 +20,7 @@ cs-fix: ## auto fix code style rules
$(PHP_PATH) vendor/bin/phpcbf $(OPTS)

static-analysis: ## verify that no new static analysis issues were introduced
$(PHP_PATH) vendor/bin/psalm $(OPTS)
$(PHP_PATH) vendor/bin/psalm --threads=1 $(OPTS)

coverage: ## generate code coverage reports
$(PHP_PATH) vendor/bin/phpunit --testsuite unit --coverage-html build/coverage-html --coverage-text $(OPTS)
Expand All @@ -41,7 +41,7 @@ deps-highest: ## Update deps to highest
$(PHP_PATH) $(COMPOSER_PATH) install

update-static-analysis-baseline: ## bump static analysis baseline issues, reducing set of allowed failures
$(PHP_PATH) vendor/bin/psalm --update-baseline
$(PHP_PATH) vendor/bin/psalm --update-baseline --threads=1

reset-static-analysis-baseline: ## reset static analysis baseline issues to current HEAD
$(PHP_PATH) vendor/bin/psalm --set-baseline=known-issues.xml
$(PHP_PATH) vendor/bin/psalm --set-baseline=known-issues.xml --threads=1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scout PHP APM Agent

[![Build](https://github.com/scoutapp/scout-apm-php/workflows/Build/badge.svg?branch=master&event=push)](https://github.com/scoutapp/scout-apm-php/actions?query=branch%3Amaster) [![Latest Stable Version](https://poser.pugx.org/scoutapp/scout-apm-php/v/stable)](https://packagist.org/packages/scoutapp/scout-apm-php) [![Total Downloads](https://poser.pugx.org/scoutapp/scout-apm-php/downloads)](https://packagist.org/packages/scoutapp/scout-apm-php) [![License](https://poser.pugx.org/scoutapp/scout-apm-php/license)](https://packagist.org/packages/scoutapp/scout-apm-php)
[![Build](https://github.com/scoutapp/scout-apm-php/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/scoutapp/scout-apm-php/actions/workflows/continuous-integration.yml) [![Latest Stable Version](https://poser.pugx.org/scoutapp/scout-apm-php/v/stable)](https://packagist.org/packages/scoutapp/scout-apm-php) [![Total Downloads](https://poser.pugx.org/scoutapp/scout-apm-php/downloads)](https://packagist.org/packages/scoutapp/scout-apm-php) [![License](https://poser.pugx.org/scoutapp/scout-apm-php/license)](https://packagist.org/packages/scoutapp/scout-apm-php)

Email us at [email protected] to get on the beta invite list!

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
"require-dev": {
"composer-plugin-api": "^2.0",
"api-ecosystem-for-laravel/dingo-api": "^3.0|^4.0",
"doctrine/coding-standard": "^10.0",
"doctrine/coding-standard": "^12.0",
"guzzlehttp/guzzle": "^7.4",
"laravel/framework": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0",
"laravel/framework": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"laravel/lumen-framework": "^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.0",
"monolog/monolog": "^1.27|^2.5|^3.0",
"nesbot/carbon": "^2.62.1",
"nesbot/carbon": "^2.62.1 || ^3.5",
"nyholm/psr7": "^1.5",
"phpunit/phpunit": "^8.5.22|^9.5.2",
"psalm/plugin-phpunit": "^0.16.1",
"psalm/plugin-phpunit": "^0.16.1 || ^0.17 || ^0.18 || ^0.19",
"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 || ^6.0",
"symfony/twig-pack": "^1.0",
"vimeo/psalm": "^4.23"
"vimeo/psalm": "^4.23 || ^5.24"
},
"suggest": {
"composer-runtime-api": "Composer v2 is required for seeing version information in metadata",
Expand Down
Loading

0 comments on commit c5213df

Please sign in to comment.