Requiring sdk package with Slim framework breaks PSR7 detection

Open Beginner friendly
#2,078 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@cjones-vultr is already working on this.

Since Oct 14, 2026.

  • #2079 by @cjones-vultr — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
observability

Research direction

The failing lookup is the try block in Trace/AutoRootSpan.php around line 73, which builds the server request via the Nyholm factory; the stack trace shows Slim's NyholmPsr17Factory being hit through ServerRequestCreatorFactory. Start by reading that block and the nyholm/psr7-server entry in composer.json. Done means the server request is created without hard-coding a Nyholm class, and the Slim app from the report runs with only guzzlehttp/psr7 installed.

Written by the indexing model from the issue text.

Description

bug

Describe your environment

open-telemetry/sdk version: 1.15.0
slim/slim version: 4.11.0
guzzlehttp/psr7 version: 2.13.1
php version: 8.4

Steps to reproduce

  1. Require the above listed packages. DO NOT require nyholm/psr7. Since we're requiring Guzzle's PSR7 implementation, that should meet the psr7 requirement for all the packages.

    composer require slim/slim:4.11.0 open-telemetry/sdk:1.15.0 guzzlehttp/psr7:2.13.1
    
  2. Write a simple Slim app like the following to a file named index.php:

    <?php
    
    require_once __DIR__.'/vendor/autoload.php';
    
    use Psr\Http\Message\ResponseInterface;
    use Psr\Http\Message\ServerRequestInterface;
    use Slim\Factory\AppFactory;
    
    $app = AppFactory::create();
    $app->get('/', function(ServerRequestInterface $request, ResponseInterface $response) {
    	$response->getBody()->write('hello world');
    	return $response;
    });
    $app->run();
    

Attempt to run it:
php index.php

What is the expected behavior?
I expect to see hello world printed.

What is the actual behavior?
An exception is thrown:

Fatal error: Uncaught Error: Class "Nyholm\Psr7\Factory\Psr17Factory" not found in /private/var/folders/kd/r97q1j9567qc1tv181jnnfm80000gp/T/tmp.fqmTOhOo4I/vendor/slim/slim/Slim/Factory/Psr17/NyholmPsr17Factory.php on line 25

Error: Class "Nyholm\Psr7\Factory\Psr17Factory" not found in /private/var/folders/kd/r97q1j9567qc1tv181jnnfm80000gp/T/tmp.fqmTOhOo4I/vendor/slim/slim/Slim/Factory/Psr17/NyholmPsr17Factory.php on line 25

Call Stack:
    0.0005     420416   1. {main}() /private/var/folders/kd/r97q1j9567qc1tv181jnnfm80000gp/T/tmp.fqmTOhOo4I/src/index.php:0
    0.0312    1421264   2. Slim\App->run($request = ???) /private/var/folders/kd/r97q1j9567qc1tv181jnnfm80000gp/T/tmp.fqmTOhOo4I/src/index.php:14
    0.0314    1427912   3. Slim\Factory\ServerRequestCreatorFactory::create() /private/var/folders/kd/r97q1j9567qc1tv181jnnfm80000gp/T/tmp.fqmTOhOo4I/vendor/slim/slim/Slim/App.php:179
    0.0314    1427912   4. Slim\Factory\ServerRequestCreatorFactory::determineServerRequestCreator() /private/var/folders/kd/r97q1j9567qc1tv181jnnfm80000gp/T/tmp.fqmTOhOo4I/vendor/slim/slim/Slim/Factory/ServerRequestCreatorFactory.php:30
    0.0320    1473192   5. Slim\Factory\Psr17\NyholmPsr17Factory::getServerRequestCreator() /private/var/folders/kd/r97q1j9567qc1tv181jnnfm80000gp/T/tmp.fqmTOhOo4I/vendor/slim/slim/Slim/Factory/ServerRequestCreatorFactory.php:47

Additional context
This issue arises because the open-telemetry/sdk package requires the nyholm/psr7-server package specifically which only provides a tiny subset of the full nyholm/psr7 package and seems to be abandoned. It is used in a single spot. I'm not certain it should be there since the php-http/discovery package is also a requirement. I think that try block could be reduced to:

$factory = new Psr17Factory();
return $factory->createServerRequestFromGlobals();

That would rely on whatever Psr17Factory the user chooses instead of tying this library to a single implementation.

Dominant language
PHP
Stars
923
Forks
234
Avg merge
1d 20h
Merged PRs (30d)
35

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-php

All issues in open-telemetry/opentelemetry-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.