Skip to content

Ensure that Nyholm PSR17 factory is fully available#3426

Open
andrewnicols wants to merge 1 commit intoslimphp:4.xfrom
andrewnicols:nyholmServerWithoutClient
Open

Ensure that Nyholm PSR17 factory is fully available#3426
andrewnicols wants to merge 1 commit intoslimphp:4.xfrom
andrewnicols:nyholmServerWithoutClient

Conversation

@andrewnicols
Copy link

We currently use Guzzle for PSR17/PSR7.

We're also now adding in open-telemetry (open-telemetry/exporter-otlp), which makes use of nyholm/psr7-server, but it does not depend on nyholm/psr7.

As a result we now have the Nyholm server request creator, but not the response Factory class.

\Slim\Factory\Psr17\Psr17Factory::isServerRequestCreatorAvailable() returns a truthy value for Nyholm, but when getServerRequestCreator() is called, it errors out.

The Nyholm PSR7 packages are split into a server package, and a client package. Both are required for the NyholmPsr17Factory to be able to return an instance of the ServerRequestCreator class.

This change amends the NyholmPsr17Factory:: isServerRequestCreatorAvailable() method to also check if the response factory class provided by the client package is available.

I can't think of a way of testing this with automated testing. For manual testing you can install nyholm/psr7-server without nyholm/psr7 -- before this change we were hitting an exception.

The Nyholm PSR7 packages are split into a server package, and a client
package. Both are required for the NyholmPsr17Factory to be able to
return an instance of the `ServerRequestCreator` class.
@odan
Copy link
Contributor

odan commented Feb 25, 2026

Thanks for the PR. It looks like coveralls.io is not available at the moment: https://status.coveralls.io/
I'll review the PR again once it's back online.

@coveralls
Copy link

Coverage Status

coverage: 99.453% (+0.004%) from 99.449%
when pulling bdd82b3 on andrewnicols:nyholmServerWithoutClient
into 025043e on slimphp:4.x.

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.

3 participants