简体   繁体   English

Yii 1.1.14与Composer自动加载

[英]Yii 1.1.14 with Composer autoload

I have my composer.json file at the root, which looks like this (after following this guide ): 我在根目录下有我的composer.json文件,看起来像这样(遵循本指南 ):

{
  "repositories": [{
    "type":"composer",
    "url": "http://packages.phundament.com"
  }],

  "require": {
    "php": ">=5.3.2",
    "yiisoft/yii": "1.1.*",
    "yiiext/migrate-command": "0.7.2",
    "thyseus/yii-user-management": "0.8"
  },

  "autoload": {
    "psr-0": { "config": "./" }
  },

  "scripts": {
      "pre-install-cmd": "config\\ComposerCallback::preInstall",
      "post-install-cmd": "config\\ComposerCallback::postInstall",
      "pre-update-cmd": "config\\ComposerCallback::preUpdate",
      "post-update-cmd": "config\\ComposerCallback::postUpdate",
      "post-package-install": ["config\\ComposerCallback::postPackageInstall"],
      "post-package-update": ["config\\ComposerCallback::postPackageUpdate"]
  }
}

My config/console.php also includes the following: 我的config / console.php还包括以下内容:

'params' => array(
    'composer.callbacks' => array(
        // args for Yii command runner
        'yiisoft/yii-install' => array('yiic', 'webapp', dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'),
        'post-update' => array('yiic', 'migrate'),
        'post-install' => array('yiic', 'migrate'),
    ),
),

I'm getting the following error, however, when I try to run composer install : 但是,当我尝试运行composer install时,我收到以下错误:

Class config\\ComposerCallback is not autoloadable, can not call pre-update-cmd script 类config \\ ComposerCallback不能自动加载,无法调用pre-update-cmd脚本

I realize it's probably something small that I've forgotten, any help would be appreciated! 我意识到这可能是我忘记的小事,任何帮助都会受到赞赏!

Looks like you are using an early version of Phundament, like this one . 看起来你正在使用早期版本的Phundament,就像这个一样。

Your composer callbacks are trying to call the methods in the ComposerCallback class, which - in your case - should be in <project-folder>/config . 你的作曲家回调试图调用ComposerCallback类中的方法,在你的情况下,它应该在<project-folder>/config

You can use the file from above and place it there or grab a more recent version from phundament/app and place the file into <project-folder>/src/Phundament and update your root composer.json autoloading section to match the new file location. 您可以使用上面的文件并将其放在那里或从phundament / app获取更新版本并将文件放入<project-folder>/src/Phundament并更新您的根composer.json 自动加载部分以匹配新文件位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM