问题
If I do $ composer require hwi/oauth-bundle
I get this:
Using version ^0.6.3 for hwi/oauth-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.2.*"
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for hwi/oauth-bundle ^0.6.3 -> satisfiable by hwi/oauth-bundle[0.6.3].
- hwi/oauth-bundle 0.6.3 requires php-http/client-implementation ^1.0 -> satisfiable by php-http/guzzle6-adapter[v2.0.1].
- hwi/oauth-bundle 0.6.3 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
- Can only install one of: php-http/httplug[v2.0.0, v1.0.0].
- Can only install one of: php-http/httplug[v2.0.0, v1.1.0].
- php-http/guzzle6-adapter v2.0.1 requires php-http/httplug ^2.0 -> satisfiable by php-http/httplug[v2.0.0].
- Conclusion: remove php-http/httplug v2.0.0
Installation failed, reverting ./composer.json to its original content.
My PHP version is:
$ php --version
PHP 7.2.15-0ubuntu0.18.04.2 (cli) (built: Mar 22 2019 17:05:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.15-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
And this is my current composer.json
:
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"sensio/framework-extra-bundle": "^5.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.2.*",
"symfony/twig-bundle": "4.2.*",
"symfony/validator": "4.2.*",
"symfony/web-link": "4.2.*",
"symfony/webpack-encore-bundle": "^1.4",
"symfony/yaml": "4.2.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.2.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.2.*"
}
}
}
My symfony version is:
$ php bin/console --version
Symfony 4.2.4 (env: dev, debug: true)
Question
How can I install hwi/oauth-bundle
in a SF v4.2.4
and with PHP v7.2.15
?
回答1:
It's a dupe of this: hwi oauth bundle and Symfony 4.2 : Impossible to install
The answer of Luc of adding this worked fine for me
"hwi/oauth-bundle": "^0.6.3",
"php-http/guzzle6-adapter": "~1.1.1",
"php-http/httplug-bundle": "~1.13"
In fact what I did is requiring them from the command line with this command:
composer require "hwi/oauth-bundle:^0.6.3" "php-http/guzzle6-adapter:~1.1.1" "php-http/httplug-bundle:~1.13"
Then when asked Do you want to execute this recipe?
(twice, one for hwi/oauth-bundle
and the other for php-http/httplug-bundle
) what I did is to tell n
and follow the recipe manually from here: https://github.com/symfony/recipes-contrib/tree/master/hwi/oauth-bundle/0.6
I added the routing file (import of routing) here https://github.com/symfony/recipes-contrib/blob/master/hwi/oauth-bundle/0.6/config/routes/hwi_oauth_routing.yaml and the package file (configuration) here https://github.com/symfony/recipes-contrib/blob/master/hwi/oauth-bundle/0.6/config/packages/hwi_oauth.yaml
Then I added the bundles modifying my bundles.php
and then finally used the manifest.json
and post-install.txt
in the recipe root to help me have a nice configuration (including the .env
suggestion which I had to change as I did not want to use Facebook but Google's one.
Same with the recipe here https://github.com/symfony/recipes-contrib/tree/master/php-http/httplug-bundle/1.6 for the HttpPlug. Just added the package config file.
来源:https://stackoverflow.com/questions/55778870/composer-could-not-resolve-dependencies-for-hwi-oauth-bundle