Closed ankushdharkar closed 8 years ago
Everything should work if you first install the php-http/guzzle6-adapter with
composer require php-http/guzzle6-adapter
and only then pull in the PHP client with
composer require swader/diffbot-php-client
(no need to define versions)
This was done so that you can use any other HTTP client implementation and can avoid Guzzle if you prefer something else.
Please let me know if the above order doesn't immediately work.
I did exactly that. Didn't work
Ok, looking into it now. Thanks
Np. Maybe because I also installed the aws-sdk-php
, it was a problem?
I doubt it. It could be that your minimum stability needs modifying. Could you try setting the minimum-stability
flag of your composer.json file, either local or global, to "beta"?
Not sure what you suggest me to change. This is my current composer.json
{
"require": {
"aws/aws-sdk-php": "^3.11",
"php-http/guzzle6-adapter": "^0.1.0"
}
}
Do you want me to do this? :
{
"require": {
"aws/aws-sdk-php": "^3.11",
"php-http/guzzle6-adapter": "^0.1.0@beta"
}
}
Found the issue. The guzzle6-adapter still hasn't had its newest version tagged and pushed to packagist, so as it is, it provides adapter-implementation rather than client-implementation. A quick workaround is manually specifying the repo:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/php-http/guzzle6-adapter"
}
],
However, due to some internal shuffling in the php-http project and upcoming releases, that'll cause this error:
- Installation request for php-http/utils ^0.1.0@dev -> satisfiable by php-http/utils[0.1.x-dev].
- php-http/utils 0.1.x-dev requires php-http/message-factory ^0.4@dev -> no matching package found.
I'm in contact with the php-http team right now and working on resolving this. Should be done soon. Sorry about this, it happens when you try to be cutting edge.
All good. Thank you for looking into it.
Don't let these setbacks deter you from providing more cutting-edge stuff ;)
Heh, thanks :)
Ok, after some changes in the php-http project and minor alterations in this client's composer file, here's the solution:
Put the following into your composer.json
file:
"minimum-stability": "dev",
"prefer-stable": true
If guzzle6-adapter is installed, remove it with
composer remove php-http/guzzle6-adapter
reinstall with
composer require php-http/guzzle6-adapter
This will install version 0.2@dev, which has the proper provides
key.
Then, you can install the diffbot client:
composer require swader/diffbot-php-client
Let me know if it's okay.
@ankushdharkar any news?
Hi @Swader. Just installed it using the above method. It succeeded. Thank you.
Will update if there are issues. Closing it for now.
On doing a composer require php-http/guzzle6-adapter
, I get a message saying Package php-http/client-tools is abandoned, you should avoid using it. Use php-http/client-common instead.
Anyway, I went ahead and used the new diffbot-php-client
. It did not work and failed with fatal errors :
PHP Fatal error: Uncaught exception 'Http\Discovery\NotFoundException' with message 'Not found' in <path>/Server/vendor/php-http/discovery/src/ClassDiscovery.php:52
Stack trace:
#0 <path>/Server/vendor/php-http/discovery/src/FactoryDiscovery.php(18): Http\Discovery\ClassDiscovery::find()
#1 <path>/Server/vendor/php-http/discovery/src/MessageFactoryDiscovery.php(49): Http\Discovery\FactoryDiscovery::find()
#2 <path>/Server/vendor/swader/diffbot-php-client/src/Diffbot.php(103): Http\Discovery\MessageFactoryDiscovery::find()
#3 <path>/Server/vendor/swader/diffbot-php-client/src/Diffbot.php(189): Swader\Diffbot\Diffbot->setHttpClient()
#4 <path>/ in <path>/Server/vendor/php-http/discovery/src/FactoryDiscovery.php on line 20
Fatal error: Uncaught exception 'Http\Discovery\NotFoundException' with message 'Not found' in <path>/Server/vendor/php-http/discovery/src/ClassDiscovery.php:52
Stack trace:
#0 <path>/Server/vendor/php-http/discovery/src/FactoryDiscovery.php(18): Http\Discovery\ClassDiscovery::find()
#1 <path>/Server/vendor/php-http/discovery/src/MessageFactoryDiscovery.php(49): Http\Discovery\FactoryDiscovery::find()
#2 <path>/Server/vendor/swader/diffbot-php-client/src/Diffbot.php(103): Http\Discovery\MessageFactoryDiscovery::find()
#3 <path>/Server/vendor/swader/diffbot-php-client/src/Diffbot.php(189): Swader\Diffbot\Diffbot->setHttpClient()
#4 <path>/ in <path>/Server/vendor/php-http/discovery/src/FactoryDiscovery.php on line 20
So, I moved back to "swader/diffbot-php-client":"^0.4.5"
(without any php-http/guzzle6-adapter
) in my composer.json
@ankushdharkar I have just released a much more stable version 2.0. Could you please test?
Fixed.
Hey @Swader. Sorry for the late reply.
I just installed 2.0
. It doesn't work if I remove "minimum-stability": "dev",
from my composer.json
. Otherwise, it seems to be working fine. Thank you.
Yes I'm sorry about needing minimimum-stability lowered, it's required for now, at least until the depending packages are released as stable. Everything should work regardless, though.
Running
composer require php-http/guzzle6-adapter
works. Adds an entry"php-http/guzzle6-adapter": "^0.1.0",
into composer.jsonRunning
composer require swader/diffbot-php-client
fails with message :