Code Monkey home page Code Monkey logo

Comments (13)

pawelkmpt avatar pawelkmpt commented on May 21, 2024 1

It also fails for me. I tried to install puli/composer-plugin as suggested in http://docs.php-http.org/en/latest/discovery.html#puli-factory-is-not-available but failed as well.

composer require puli/composer-plugin
                                                                                                                                                                                     
  [InvalidArgumentException]                                                                                                                                                         
  Could not find a version of package puli/composer-plugin matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability. 

Defining version of that package also fails as one of its dependencies doesn't meet minimum stability condition. Basically chain reaction of errors.

from slack-php-api.

pyrech avatar pyrech commented on May 21, 2024

Hum, it looks like php-http fails to find a suitable factory for http messages. And I'm pretty sure Puli is not the best option for you.
Did you run the command compose composer require php-http/curl-client guzzlehttp/psr7? What was the output? It should have install the factories from Guzzle.

from slack-php-api.

kylelondonuk avatar kylelondonuk commented on May 21, 2024

Hi - thanks for such a quick response! Yes I ran that command and it all seemed fine. it suggested installing a few more at the end, but no errors... here it is:

Using version ^2.0 for php-http/curl-client
Using version ^1.5 for guzzlehttp/psr7
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 13 installs, 0 updates, 0 removals
  - Installing symfony/options-resolver (v4.2.4): Loading from cache
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing psr/http-factory (1.0.0): Loading from cache
  - Installing psr/http-client (1.0.0): Loading from cache
  - Installing clue/stream-filter (v1.4.0): Loading from cache
  - Installing php-http/message-factory (v1.0.2): Loading from cache
  - Installing php-http/message (1.7.2): Loading from cache
  - Installing php-http/promise (v1.0.0): Loading from cache
  - Installing php-http/httplug (v2.0.0): Loading from cache
  - Installing php-http/discovery (1.6.1): Loading from cache
  - Installing php-http/curl-client (2.0.0): Loading from cache
  - Installing ralouphie/getallheaders (2.0.5): Loading from cache
  - Installing guzzlehttp/psr7 (1.5.2): Loading from cache
php-http/message suggests installing zendframework/zend-diactoros (Used with Diactoros Factories)
php-http/message suggests installing slim/slim (Used with Slim Framework PSR-7 implementation)
php-http/discovery suggests installing puli/composer-plugin (Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details.)

and then the jolicode also seems fine:

Using version ^1.1 for jolicode/slack-php-api
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 17 installs, 0 updates, 0 removals
  - Installing php-http/client-common (2.0.0): Loading from cache
  - Installing php-http/multipart-stream-builder (1.0.0): Loading from cache
  - Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
  - Installing symfony/yaml (v4.2.4): Loading from cache
  - Installing symfony/serializer (v4.2.4): Loading from cache
  - Installing php-jsonpointer/php-jsonpointer (v3.0.2): Loading from cache
  - Installing league/uri-parser (1.4.1): Loading from cache
  - Installing league/uri-interfaces (1.1.1): Loading from cache
  - Installing league/uri-schemes (1.2.1): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing league/uri-hostname-parser (1.1.1): Loading from cache
  - Installing league/uri-components (1.8.2): Loading from cache
  - Installing league/uri-manipulations (1.5.0): Loading from cache
  - Installing jane-php/json-schema-runtime (v4.2.0): Loading from cache
  - Installing jane-php/open-api-runtime (v4.2.0): Loading from cache
  - Installing jolicode/slack-php-api (1.1.3): Loading from cache
php-http/client-common suggests installing php-http/logger-plugin (PSR-3 Logger plugin)
php-http/client-common suggests installing php-http/cache-plugin (PSR-6 Cache plugin)
php-http/client-common suggests installing php-http/stopwatch-plugin (Symfony Stopwatch plugin)
symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command)
symfony/serializer suggests installing psr/cache-implementation (For using the metadata cache.)
symfony/serializer suggests installing symfony/property-info (To deserialize relations.)
symfony/serializer suggests installing symfony/config (For using the XML mapping loader.)
symfony/serializer suggests installing symfony/property-access (For using the ObjectNormalizer.)
symfony/serializer suggests installing symfony/http-foundation (To use the DataUriNormalizer.)
symfony/serializer suggests installing doctrine/annotations (For using the annotation mapping. You will also need doctrine/cache.)
symfony/serializer suggests installing doctrine/cache (For using the default cached annotation reader and metadata cache.)
league/uri-hostname-parser suggests installing psr/simple-cache-implementation (To enable using other cache providers)
Writing lock file
Generating autoload files

from slack-php-api.

kylelondonuk avatar kylelondonuk commented on May 21, 2024

And then I run this with my token, which is where the error comes:

$client = JoliCode\Slack\ClientFactory::create($yourToken);

from slack-php-api.

kylelondonuk avatar kylelondonuk commented on May 21, 2024

And if it helps, here's the composer.json file:

"require": {
        "php-http/curl-client": "^2.0",
        "guzzlehttp/psr7": "^1.5",
        "jolicode/slack-php-api": "^1.1"
    }

from slack-php-api.

kylelondonuk avatar kylelondonuk commented on May 21, 2024

Ah, i did

composer require zendframework/zend-diactoros

and that worked - was the problem just that guzzle wasn't installing the discovery factories for me?

from slack-php-api.

pyrech avatar pyrech commented on May 21, 2024

This behavior is quite strange because, as far as I know, zendframework/zend-diactoros & guzzlehttp/psr7 are equivalent libraries providing both PSR-7 implementations. They should work similarly. I do not really understand why guzzle's one is not detected correctly by the CommonClassesStrategy discovery 😕

I would say if Zend Diactoros works for you, just go ahead with it and remove guzzlehttp/psr7 😉

from slack-php-api.

vmunich avatar vmunich commented on May 21, 2024

I was having this when using guzzlehttp/psr7:

Http/Discovery/Exception/ClassInstantiationFailedException with message 'Unexpected exception when instantiating class.'

However, it works as expected when I install zendframework/zend-diactoros instead.

from slack-php-api.

damienalexandre avatar damienalexandre commented on May 21, 2024

Confirmed, the installation steps are broken. I'm going to take a deeper look at it.

from slack-php-api.

damienalexandre avatar damienalexandre commented on May 21, 2024

As a quick fix you can just force this package to version 1.x, the new 2.x version seams to be the problem:

"php-http/curl-client": "^1.0",

from slack-php-api.

damienalexandre avatar damienalexandre commented on May 21, 2024

Just updated the documentation. Please do not use curl-client 2.0, I have no idea why it does not found the client.

composer require php-http/curl-client:"^1.7" guzzlehttp/psr7

from slack-php-api.

pawelkmpt avatar pawelkmpt commented on May 21, 2024

composer require php-http/curl-client:"^1.7" guzzlehttp/psr7

it works! thanks!

from slack-php-api.

pyrech avatar pyrech commented on May 21, 2024

Closing as this issue is fixed now. Please feel free to submit a new issue if someone face again a similar error 🙂

from slack-php-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.