这个问题在这里:
/**
* In some special setups, the vendor/ directory isn't located in the project's
* root directory. To make this command work for every case, read Composer's
* vendor/ directory location directly from composer.json file.
*
* @return string
*/
private function getComposerVendorDir()
{
$composerJson = json_decode(file_get_contents(__DIR__.'/../composer.json'));
if (isset($composerJson->config)) {
return $composerJson->config->{'vendor-dir'};
}
return __DIR__.'/../vendor/composer';
}
具体来说:
return $composerJson->config->{'vendor-dir'};
条件 onisset($composerJson->config)
返回 true,从而导致上述语句。但是,当您查看生成的 composer.json 时:
"config": {
"bin-dir": "bin"
},
vendor-dir
失踪了。生成通知:
PHP Notice: Undefined property: stdClass::$vendor-dir
因此该函数返回 null,因此此要求失败:
$this->addRequirement(
is_dir($this->getComposerVendorDir()), // <-- HERE
'Vendor libraries must be installed',
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
'Then run "<strong>php composer.phar install</strong>" to install them.'
);
这是symfony/symfony-standard
. 它很可能已经在修复中,但你也可以在 Github 上提出它。
编辑:
看起来他们已经有,2.7用途:
$this->addRequirement(
is_dir(__DIR__.'/../vendor/composer'),
'Vendor libraries must be installed',
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
'Then run "<strong>php composer.phar install</strong>" to install them.'
);
您的项目没有任何问题,它只是标准版中的一个错误。只要您正确地自动加载类,就可以了。