Publishing to Packagist

Publishing a Package to Packagist

Commit the package, then try it from its consumer. A path repository symlinks a local directory into vendor/ and reports its checked-out branch as the version, hence dev-main. The shop's index.php requires vendor/autoload.php, imports Monolog 21,402 's Logger and the package's money(), and logs an order total:

Tagging a release, then using it from the shop through a path repositoryShell
composer validate --strict && git tag v1.0.0         # in shop-money/
cd ../shop
composer repo add shop-money path ../shop-money       # the repository command of Composer 2.9
composer require acme/shop-money:dev-main
php index.php
Output
./composer.json is valid
...
  - Installing acme/shop-money (dev-main 2ef2702): Symlinking from ../shop-money
...
[2026-09-23T08:18:14.040198+00:00] checkout.INFO: Order placed {"total":"$24.99"} []

Packagist 4,624 (https://packagist.org 4,624 ) listed 468,765 packages on 23 September 2026. It stores only metadata; each version is a tag in your public repository. Publishing needs an account and a public repository, so it was not run here:

  1. Push the repository, with .gitattributes marking /tests export-ignore so tests stay out of the download.

  2. Sign in to packagist.org with GitHub 29 , choose Submit and paste the repository URL; the vendor name acme is then reserved for you.

  3. Let the Packagist GitHub app resync on every push, or add a webhook to https://packagist.org/api/github?username=YOURNAME 4,624 with your API token.

  4. Tag releases vX.Y.Z using semantic versioning; the shop can then require ^1.0 and drop the path repository. Private packages go to a self-hosted Satis 3,305 (https://github.com/composer/satis 3,305 ) index or the commercial Private Packagist 128,519 .