From 7b707e46d81a3be803e1b1e2fc1443b0cef2002f Mon Sep 17 00:00:00 2001 From: Christopher Gammie Date: Sat, 28 Mar 2026 17:14:59 +0000 Subject: [PATCH 1/2] feat: add Laravel 13 compatibility --- .github/workflows/tests.yml | 18 ++++++++---------- CHANGELOG.md | 4 ++++ composer.json | 12 ++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f1f09c4..ac6e8a3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,16 +18,17 @@ jobs: strategy: fail-fast: true matrix: - php: [ 8.2, 8.3, 8.4 ] - core: [ '4.3.2', '5.2' ] - laravel: [ 11, 12 ] + php: [ 8.2, 8.3, 8.4, 8.5 ] + laravel: [ 11, 12, 13 ] exclude: - - laravel: 12 - core: '4.3.2' + - php: 8.5 + laravel: 11 + - php: 8.2 + laravel: 13 steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -38,14 +39,11 @@ jobs: coverage: none ini-values: error_reporting=E_ALL - - name: Set Laravel JSON:API Core Version - run: composer require "laravel-json-api/core:^${{ matrix.core }}" --no-update - - name: Set Laravel Version run: composer require "illuminate/contracts:^${{ matrix.laravel }}" --no-update - name: Install dependencies - uses: nick-fields/retry@v3 + uses: nick-fields/retry@v4 with: timeout_minutes: 5 max_attempts: 5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 74da85e..fcbea61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. This projec ## Unreleased +### Changed + +- Dropped support for `laravel-json-api/core` v4. + ## [3.2.0] - 2025-02-24 ### Added diff --git a/composer.json b/composer.json index ab45c2c..7d506f4 100644 --- a/composer.json +++ b/composer.json @@ -25,14 +25,14 @@ "require": { "php": "^8.2", "ext-json": "*", - "illuminate/contracts": "^11.0|^12.0", - "illuminate/pipeline": "^11.0|^12.0", - "laravel-json-api/core": "^4.3.2|^5.2", - "laravel-json-api/validation": "^4.2" + "illuminate/contracts": "^11.0|^12.0|^13.0", + "illuminate/pipeline": "^11.0|^12.0|^13.0", + "laravel-json-api/core": "^5.3", + "laravel-json-api/validation": "^4.4" }, "require-dev": { "laravel-json-api/testing": "^3.1", - "orchestra/testbench": "^9.0|^10.0", + "orchestra/testbench": "^9.0|^10.0|^11.0", "phpunit/phpunit": "^10.5|^11.5.3" }, "autoload": { @@ -50,7 +50,7 @@ "dev-develop": "3.x-dev" } }, - "minimum-stability": "stable", + "minimum-stability": "dev", "prefer-stable": true, "config": { "sort-packages": true From 85e94fdf69f52a6c6b85000742335187d0c9c095 Mon Sep 17 00:00:00 2001 From: Christopher Gammie Date: Sat, 28 Mar 2026 17:23:31 +0000 Subject: [PATCH 2/2] tests: fix accept header test which fails with Laravel 11 --- tests/Integration/AcceptHeaderTest.php | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/Integration/AcceptHeaderTest.php b/tests/Integration/AcceptHeaderTest.php index b182193..1eca3f7 100644 --- a/tests/Integration/AcceptHeaderTest.php +++ b/tests/Integration/AcceptHeaderTest.php @@ -150,10 +150,13 @@ public function testAcceptsMiddlewareDoesNotMatch(): void ->acceptsMiddleware('foo', 'bar') ->renderable(); - $this->get('/test', ['Accept' => '*/*']) + $response = $this->get('/test', ['Accept' => '*/*']); + + $response ->assertStatus(418) - ->assertHeader('Content-Type', 'text/html; charset=UTF-8') ->assertSee('teapot'); + + $this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type'))); } /** @@ -167,11 +170,7 @@ public function testAcceptsMiddlewareWhenRouteNotFound(): void $response = $this->get('/blah', ['Accept' => '*/*']); $response->assertStatus(404)->assertSee('Not Found'); - - // @TODO remove once Laravel 8 is no longer supported (8 doesn't add the header) - if (version_compare(Application::VERSION, '9.0.0') >= 0) { - $response->assertHeader('Content-Type', 'text/html; charset=UTF-8'); - } + $this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type'))); } public function testAcceptsMiddlewareWhenRouteNotFoundWithJsonApiMediaType(): void @@ -223,10 +222,12 @@ public function testAcceptFalse(): void ->accept(fn(\Throwable $ex, Request $request) => false) ->renderable(); - $this->get('/test', ['Accept' => '*/*']) - ->assertStatus(418) - ->assertHeader('Content-Type', 'text/html; charset=UTF-8') + $response = $this->get('/test', ['Accept' => '*/*']); + + $response->assertStatus(418) ->assertSee('teapot'); + + $this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type'))); } public function testAcceptFalseWithJsonApiAcceptHeader(): void @@ -279,9 +280,12 @@ public function testMultipleAcceptCallbacks2(): void public function testHtml(): void { - $this->get('/test', ['Accept' => '*/*']) + $response = $this->get('/test', ['Accept' => '*/*']); + + $response ->assertStatus(418) - ->assertHeader('Content-Type', 'text/html; charset=UTF-8') ->assertSee('teapot'); + + $this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type'))); } }