Skip to content

feat(composer): allow API Platform 5 - #89

Merged
paullla merged 2 commits into
Locastic:masterfrom
webstacknl:api-platform-5
Nov 3, 2026
Merged

paullla merged 2 commits into
Locastic:masterfrom
webstacknl:api-platform-5

Conversation

@mwansinck

@mwansinck mwansinck commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Issues -
License MIT

Problem

The bundle cannot be installed alongside API Platform 5: api-platform/symfony is constrained to ^3.4 || ^4.0, so Composer refuses to resolve a project that requires api-platform/core:^5.0.

Changes

  • Widen api-platform/symfony (and the dev requirement api-platform/core) to ^3.4 || ^4.0 || ^5.0. No source changes were needed.
  • Add symfony/http-client as a dev requirement. With API Platform 5.0.2 the functional test kernel fails to compile without it: TestClientPass loads ApiPlatform\Symfony\Bundle\Test\Client, which uses HttpClientTrait (Error: Trait "Symfony\Component\HttpClient\HttpClientTrait" not found, 7 tests in ConfigurationTest).
  • Update the supported-versions table in the README and add a line to the Unreleased section of the changelog.

Verification

Run locally:

  • API Platform 5.0.3, highest (Symfony 8.1.8, Doctrine ORM 3.7.4, DoctrineBundle 3.3.2), on PHP 8.4.25 and 8.5.10:
    • bin/phpunit: 100 tests, 209 assertions, OK
    • bin/phpstan analyse: no errors
    • bin/php-cs-fixer check: nothing to fix
    • composer validate --strict: valid
  • API Platform 4.4.3 (composer update --with api-platform/core:^4.0), on PHP 8.5.10:
    • bin/phpunit: 100 tests, 209 assertions, OK
  • The PHP 8.2 / --prefer-lowest --prefer-stable job, on PHP 8.2.34 (php:8.2-cli container). This resolves to API Platform 4.1.30 (Symfony 6.4.0, Doctrine ORM 3.0.0, DoctrineBundle 2.13.0):
    • bin/phpunit: 100 tests, 209 assertions, OK
    • composer validate --strict: valid
  • API Platform 3.4.0 (composer update --prefer-lowest --prefer-stable --no-security-blocking --with api-platform/core:^3.4), on PHP 8.2.34:
    • bin/phpunit: 100 tests, 209 assertions, OK

Note on the lowest job: it does not install API Platform 3.4. Composer blocks every 3.4 release because of security advisories, so --prefer-lowest falls back to 4.1.30. API Platform 3.4 is only reachable with --no-security-blocking, which is how the last run above was done.

🤖 Generated with Claude Code

Widen api-platform/symfony (and the dev requirement api-platform/core) to
also accept ^5.0. No source changes are needed.

symfony/http-client is added as a dev requirement: with API Platform 5 the
functional test kernel fails to compile without it (TestClientPass loads
ApiPlatform\Symfony\Bundle\Test\Client, which uses HttpClientTrait).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paullla

paullla commented Nov 2, 2026

Copy link
Copy Markdown
Member

@mwansinck Thank you for the PR, this looks good.

One request before merge: with this change the highest CI jobs resolve API Platform 5, so 4.2–4.4 lose CI coverage (lowest stays on 4.1.30). Could you add a matrix job pinned to 4.4, for example composer require --dev --no-update api-platform/core:^4.4 before the install step?

With API Platform 5 allowed, the highest jobs resolve 5.x and the lowest
job stays on 4.1, so 4.2-4.4 lost CI coverage. Add a PHP 8.5 highest job
that runs `composer require --dev --no-update api-platform/core:^4.4`
before installing.

api-platform is listed in the matrix with an empty default; otherwise
GitHub merges the include into the existing PHP 8.5 highest job instead
of adding a new one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mwansinck

Copy link
Copy Markdown
Contributor Author

Thanks! Added a PHP 8.5 highest (API Platform ^4.4) job that runs composer require --dev --no-update api-platform/core:^4.4 before installing. api-platform is listed in the matrix with an empty default; without it GitHub would merge the include into the existing PHP 8.5 highest job instead of adding a new one. Locally it resolves to API Platform 4.4.6 (Symfony 8.1.10) on PHP 8.5.12: 100 tests, OK.

@paullla
paullla merged commit b9b316f into Locastic:master Nov 3, 2026
7 checks passed
paullla added a commit that referenced this pull request Nov 3, 2026
Rename the Unreleased section to 2.1.0 and add the compare links. Add the missing PR numbers (#87, #89) to their entries. Set the master branch alias to 2.x-dev.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants