将yii2与mongodb连接

Ash*_*win 5 mongodb yii2 yii2-advanced-app

我是Yii2的新手.谁能告诉我如何用mongodb配置YII2以及如何在YII2和mongodb之间建立连接?我试图从git hub下载mongodb软件包并尝试运行以下命令

php composer.phar require --prefer-dist yiisoft/yii2-mongodb "*"
Run Code Online (Sandbox Code Playgroud)

在我已安装Yii2的根文件夹内的命令提示符下,但是我收到以下错误

 Your requirements could not be resolved to an installable set of packages.
 Problem 1
- yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching      package found.
- yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- Installation request for yiisoft/yii2 == 2.0.0.0 -> satisfiable by yiisoft/yii2[2.0.0].
Run Code Online (Sandbox Code Playgroud)

Sha*_*gie 6

如果您尝试通过命令提示符安装它,请尝试使用composer的以下命令

composer require --prefer-dist yiisoft/yii2-mongodb "*"
Run Code Online (Sandbox Code Playgroud)

这适用于我的Windows 8环境.

要在安装程序包使用--ignore-platform-refs开关时忽略依赖项错误:

composer require --ignore-platform-refs --prefer-dist yiisoft/yii2-mongodb "*"
Run Code Online (Sandbox Code Playgroud)

  • MongoDB包不是导致问题的那个,就是安装正常,他遇到了问题,因为他没有正确地遵循安装教程 (2认同)