无法安装作曲家包

Not able to install composer package

我正在尝试安装我为学习而构建的第一个 composer 包。

为此,我已成功设置 Github 存储库和 packagist 帐户:

https://github.com/xparthx/Composer-package-demo

https://packagist.org/packages/xparthxvorax/demo

问题是当我尝试使用 composer require xparthxvorax/demo 安装它时,出现以下错误:

[UnexpectedValueException]
Error while installing xparthxvorax/demo, composer-plugin packages should have a class defined in their extra key to be usable.

我认为问题出在包裹类型上。根据此文档,默认包类型应为 library:

https://getcomposer.org/doc/04-schema.md#type

创建一个新标签,因为使用 composer require composer 会尝试安装最新的标签,在您的情况下是 "composer-plugin" 类型的标签:https://github.com/xparthx/Composer-package-demo/blob/v1/composer.json