I'm trying to install this plugin: https://github.com/ichikaway/cakephp-mongodb/ into my CakePHP project using Composer. And everything was smooth, but it installed into [project root]/Plugin (directory created by Composer I guess) instead of [project root]/app/Plugin.

我正在尝试使用Composer将这个插件:https://github.com/ichikaway/cakephp-mongodb/安装到我的CakePHP项目中。一切顺利,但它安装到[project root] / Plugin(我猜测由Composer创建的目录)而不是[project root] / app / Plugin。

Obviously, in that case, it's impossible to load it by using:

显然,在这种情况下,使用以下方法加载它是不可能的:

<?php
//app/Config/bootstrap.php
CakePlugin::load('Mongodb');

If I manually move it to the second dir, it works just fine. But then I have two directories, which is terribly misleading. I know from my experience that one will eventually assume the plugin gets updated while in fact, in app/Plugin there's an older version of it, the one i had to manually copy there.

如果我手动将它移动到第二个目录,它就可以正常工作。但后来我有两个目录,这是非常误导。我从我的经验中知道,最终会假设插件得到更新,而实际上,在app / Plugin中有一个旧版本,我必须手动复制那里。

So my question is: How do I do install CakePHP plugins from Composer properly, so they go into app/Plugin?

所以我的问题是:如何正确安装Composer中的CakePHP插件,以便进入app / Plugin?

Thanks for the help!

谢谢您的帮助!

1 个解决方案

#1


Add the required plugin line to /app/composer.json instead of adding it to /composer.json.

将所需的插件行添加到/app/composer.json,而不是将其添加到/composer.json。

Minimum contents of app/composer.json:

app / composer.json的最小内容:

{
    "require": {
        "ichikaway/cakephp-mongodb": "2.2.*@dev"
    }
}

Then just run composer update from your console while in the app folder instead of from your project's root folder. This will install it to the Plugin directory relative to your current position on the server.

然后在app文件夹中而不是从项目的根文件夹中,从控制台运行composer update。这将相对于您在服务器上的当前位置将其安装到Plugin目录中。

更多相关文章

  1. weiphp插件开发注意
  2. php is_dir 判断是否存在这目录
  3. php删除指定目录下的的文件/文件夹-用PHP怎么删除某目录下指定的
  4. php清理当前目录下的指定文件和空目录(源码),建议服务器端执行
  5. 韩顺平_php从入门到精通_视频教程_学习笔记_源代码图解_PPT文档
  6. php读取目录及子目录下所有文件名的方法
  7. php预定义常量目录分隔符
  8. SQLSTATE [HY000] [2002]没有这样的文件或目录
  9. mysql启动脚本——指定数据目录并指定配置文件

随机推荐

  1. android获取文件目录
  2. Android代码实现APK文件的安装与卸载
  3. Android(安卓)-- Camera源码简析,启动流程
  4. 开源中国-android软件资源整理
  5. ProgressDialog
  6. 开发中常用到的几处代码设置
  7. [AndroidTips]Keep Screen On in Android
  8. android案例
  9. asdsadsa
  10. android 去掉listview之间的黑线