如何在 Packagist 中重命名 PHP 包

How to rename a PHP package in Packagist

我将 composer 文件中的 PHP 包名称从 "name": "author/author-php" 更改为 "name": "author/author" 然后做了 composer install & composer update,然后将我的更改与 master 合并创建了一个版本。

但是在 Packagist 上更新库后,新名称不起作用,作曲家在 composer require author/author 找不到它,我什至无法下载这个新版本。

注意:repo 名称仍然是 author-php 这就是 Packagist 没有重命名的原因吗?

到目前为止,你不能更新包名,我相信是出于安全原因(如果允许重命名,有害代码可以作为旧名称,然后还没有更新它们的依赖项目 composer.json 会提取有害代码)。 Packagist's Github page上已经讨论过了,这种操作的流程是这个(从上面link复制粘贴的):

  • Update the name in composer.json on the master branch or whatever the default branch is
  • Resubmitting the package to packagist using the new name
  • Mark the old package as "Abandoned" on packagist, and use the new name in the form so that people get pointed to it when they install with the old name
  • And no you can't keep your download stats