Comments (13)
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.
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.
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.
And then I run this with my token, which is where the error comes:
$client = JoliCode\Slack\ClientFactory::create($yourToken);
from slack-php-api.
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.
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.
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.
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.
Confirmed, the installation steps are broken. I'm going to take a deeper look at it.
from slack-php-api.
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.
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.
composer require php-http/curl-client:"^1.7" guzzlehttp/psr7
it works! thanks!
from slack-php-api.
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)
- No text error code? HOT 4
- Example has syntax error HOT 3
- Type hint on @return is confusing HOT 1
- Method does not specify that exception might be thrown. HOT 4
- Some values not reachable? HOT 4
- ConversationsRepliesGetResponse200 should provide typing for `messages` other than `mixed[]` HOT 5
- UsersList and UsergroupsList should accept new parameter: "team_id" HOT 2
- Don't use deprecated factory method
- Required fields in `Objs*` classes should not be nullable HOT 1
- Question: Recommended endpoint for `response_url` HOT 3
- setNormalizer() must implement interface Symfony\Component\Serializer\Normalizer\NormalizerInterface HOT 1
- Missing @throws in the phpdocs HOT 2
- Support for the Bookmarks API? HOT 2
- Creation of dynamic property JoliCode\Slack\Api\Endpoint\ChatPostMessage::$formParameters is deprecated HOT 5
- Fatal Error Jane\JsonSchemaRuntime\Normalizer\CheckArray HOT 7
- Requirement for Read Only Repo: jane-php/open-api-runtime HOT 1
- Fatal error: Declaration of `ChatPostMessage::transformResponseBody()` must be compatible with `Jane\OpenApiRuntime\Client\EndpointTrait` HOT 1
- Discussion: Jane8 and `psr/http-message:^2.0` HOT 1
- Image Blocks in posts returning "invalid_blocks" error. HOT 1
- Flacky CI due to Slack rate limit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slack-php-api.