Skip to content

DiscoveryFailedException Slim Request Factory #190

Closed
@NicoP-S

Description

@NicoP-S

PHP version: 7.3.23

Description

I am trying to get GitLabPHP/Client running with Slim Psr7 ( psr17 compliant ). It uses discovery.

The Docs say that slim framework should work:

A built-in strategy supporting the HTTPlug adapters, clients and factories (including Symfony, Guzzle, Diactoros and Slim Framework)

Error Message:

PHP Fatal error:  Uncaught Http\Discovery\Exception\DiscoveryFailedException: Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors
 - Puli Factory is not available
 - No valid candidate found using strategy "Http\Discovery\Strategy\CommonClassesStrategy". We tested the following candidates: .
 - No valid candidate found using strategy "Http\Discovery\Strategy\CommonPsr17ClassesStrategy". We tested the following candidates: Phalcon\Http\Message\RequestFactory, Nyholm\Psr7\Factory\Psr17Factory, Zend\Diactoros\RequestFactory, GuzzleHttp\Psr7\HttpFactory, Http\Factory\Diactoros\RequestFactory, Http\Factory\Guzzle\RequestFactory, Http\Factory\Slim\RequestFactory, Laminas\Diactoros\RequestFactory.

 in /tmp/gitlabtest/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php:41
Stack trace:
#0 /tmp/gitlabtest/vendor/php-http/discovery/src/ClassDiscovery.php(79): Http\Discovery\Exception\DiscoveryFailedException::create(Array)
#1 /tmp in /tmp/gitlabtest/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php on line 22

It checks for Http\Factory\Slim\RequestFactory.
I have checked my vendor dir but I only got Slim\Psr7\Factory\RequestFactory

I don't know if it is a problem of slimphp/Slim-Psr7 or this repo. Or maybe my setup?

How to reproduce

composer require m4tthumphrey/php-gitlab-api:^10.0 guzzlehttp/guzzle:^7.0.1 slim/slim slim/psr7

test.php:

<?php
include('vendor/autoload.php');
$client = new \Gitlab\Client();

Possible Solution

Additional context

GitLabPHP/Client#586

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions