Skip to content
PolyPack
Docs: Composer

Composer

Install a private Composer Pack, and publish one by pushing to GitHub.

These are the lines PolyPack shows on a Composer Pack's page, here for Hopper Digital's hopper/widgets.

Install

Add the repository · in the project; it goes in composer.json, safe to commit
composer config repositories.hopper composer https://hopper.pkg.polypack.io/composer
Store your Token · once per machine; it goes in your own auth.json, never the project
composer config --global --auth bearer.hopper.pkg.polypack.io <your Token>
Install
composer require hopper/widgets

The repository line is safe to commit: it holds no secret. The Token goes in your own auth.json, never in the project. Public Packs need no Token.

Publish

Composer Packs come from GitHub. An Admin connects the PolyPack GitHub App to the Team and binds a repository to the Pack. From then on:

  • every Git tag becomes a release, such as v1.4.0 becoming 1.4.0;
  • the default branch becomes a dev version, such as dev-main, and so does any branch matching the Pack's branch patterns (for example *.x);
  • a push, a new tag or a deleted branch is synced within moments, and each Sync is listed on the Pack's page with what it did and why.

PolyPack builds and stores a zip of each version, so installs never depend on GitHub being up.

Monorepos

One repository can hold several Composer Packs, each in its own directory, such as packages/forms and packages/tables. No split repositories are needed.

  • On the Repositories page, Find Packs lists every composer.json on the default branch. Tick the ones to sync: each is bound to the Pack of its name, which is created if the Team has none.
  • Each version of a Pack holds its directory only, with its files at the top, just as Composer would get them from a repository of their own.
  • By default, a Git tag such as v2.0.0 releases every Pack of the repository. To release a Pack on its own, give it a tag prefix, such as tables/: then only tags such as tables/v2.0.0 release it, as v2.0.0, and the other Packs leave those tags alone.
  • A push that changes one package leaves the others' dev versions as they were: nothing is rebuilt for a directory that did not change.

Abandoned Packs

An Admin can mark a Composer Pack abandoned, optionally naming its replacement. Composer then warns everyone who installs it.

For CI pipelines, see CI.