Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename a PHP package in Packagist

I changed a PHP package name in composer file from "name": "author/author-php" to "name": "author/author" then did composer install & composer update, merged my changes with master then created a release.

But after updating the library on Packagist, the new name did not work and composer could not find it at composer require author/author and I could not even download this new release.

Note: the repo name is still author-php so is this the reason Packagist did not renamed it?

like image 933
Nuha Avatar asked Mar 27 '19 13:03

Nuha


People also ask

How do I upload a package to Packagist?

To submit a package to Packagist, first create an account open in new window and then use the Submit link open in new window and specify the public repository URL to the git repository of your package. Packagist will now host a so-called dev-master version of your package.

What does Packagist do?

Packagist is the default Composer package repository. It lets you find packages and lets Composer know where to get the code from. You can use Composer to manage your project or libraries' dependencies - read more about it on the Composer website. You can find the packagist.org source on GitHub.

What is a composer package?

Composer is a dependency manager. It installs packages locally. A package is essentially a directory containing something. In this case it is PHP code, but in theory it could be anything.

What is private Packagist?

Private Packagist is a commercial package hosting product offering professional support and web based management of private and public packages, and granular access permissions.


1 Answers

As of now, you cannot update a package name, I believe for security reasons (if renaming was allowed, harmful code could be put as the old name, and then dependent projects that haven't updated their composer.json would pull the harmful code). It has been discussed on Packagist's Github page, and the process in place for this kind of operation is this one (copypasted from the above 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
like image 75
linkboss Avatar answered Oct 10 '22 10:10

linkboss