我是作曲家的新手。但是我正在尝试创建一个自定义类,该类将依赖包安装在我的项目的根目录中,而不是在供应商目录中。我尝试按照 getcomposer.org 上的示例进行操作,但出现以下错误:
PHP Fatal error: Class 'jeffreycwitt\Composer\LombardPressInstaller' not found in phar:///usr/local/bin/composer/src/Composer/Installer/InstallerInstaller.php on line 100
Fatal error: Class 'jeffreycwitt\Composer\LombardPressInstaller' not found in phar:///usr/local/bin/composer/src/Composer/Installer/InstallerInstaller.php on line 100
下面是我制作的 composer.json 和自定义类。你能看出有什么问题吗???
作曲家.json
{
"name": "jeffreycwitt/lombardpress-installer",
"type": "composer-installer",
"license": "MIT",
"autoload": {
"psr-0": {"jeffreycwitt\\Composer": ""}
},
"extra": {
"class": "jeffreycwitt\\Composer\\LombardPressInstaller"
}
}
lombardpressInstaller.php
namespace jeffreycwitt\Composer;
use Composer\Package\PackageInterface;
use Composer\Installer\LibraryInstaller;
class LombardPressInstaller extends LibraryInstaller
{
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
return '';
}
/**
* {@inheritDoc}
*/
public function supports($packageType)
{
return 'jeffreycwitt-lombardpress' === $packageType;
}
}