Composer registry
A Composer Package artifact is a private PHP package repository at https://composer.registry.sh. The Composer Publish action publishes the package, and the application installs it with a regular composer install. Each published package version is an artifact version.
Package naming
The package name has the form <workspace>/<artifact>. The my-php-lib artifact in the my-workspace workspace accepts only the my-workspace/my-php-lib package, so the name field in the package's composer.json must have exactly this value.
You do not need to change the PHP namespaces in your code.
Artifact creation
You create the artifact in the UI: in Artifacts, click New artifact and select Composer Package. If an artifact with that name does not exist, the Composer Publish action creates it on the first run. Such an artifact has project scope and Buddy Auth access.
Package publishing in pipelines
The Composer Publish action publishes the contents of a directory containing a composer.json file. All files in the specified directory are included, including dotfiles and files excluded by .gitignore. Only the .git directory is excluded. To limit the package contents, copy the required files to a separate directory before publishing:
- action: Prepare package
type: BUILD
docker_image_name: library/composer
docker_image_tag: "2"
commands: |-
composer validate --no-check-publish
rm -rf dist && mkdir dist
cp -r composer.json src dist/
- action: Publish to Composer registry
type: COMPOSER_PUBLISH
artifact: my-php-lib
path: dist
version: 1.0.0
To point the path field at the root of the pipeline filesystem, use /, not ..
The version comes from the action's Version field or from composer.json. It must be a valid semantic version without a v prefix, so a version taken from a Git tag, such as v1.1.0, fails validation. The action fields are described in the Composer Publish reference. Outside a pipeline, you can publish the package with bdy artifact composer publish.
Image loading...
Version immutability
Published package versions cannot be overwritten. Package changes require publication of a new version.
Package installation
In the application's composer.json, add the repository and the dependency:
{
"repositories": [
{ "type": "composer", "url": "https://composer.registry.sh" }
],
"require": {
"my-workspace/my-php-lib": "^1.0"
}
}
The Pull artifact window in the artifact view shows a ready composer.json snippet for that artifact.
Image loading...
Registry authentication
The registry requires a personal access token with permission to read artifacts. On a developer machine, save the token in the global Composer configuration:
composer config --global bearer.composer.registry.sh "$REGISTRY_TOKEN"
$In a pipeline, store the token in an encrypted variable, for example COMPOSER_TOKEN, and pass it through COMPOSER_AUTH. The credentials then do not end up in an auth.json file, and the token is masked in the action log:
- action: Install dependencies
type: BUILD
docker_image_name: library/composer
docker_image_tag: "2"
commands: |-
export COMPOSER_AUTH="{\"http-basic\":{\"composer.registry.sh\":{\"username\":\"token\",\"password\":\"$COMPOSER_TOKEN\"}}}"
composer install --no-interaction --prefer-dist
The same token and command work in another CI system.
Publishing permissions
An artifact created by the Composer Publish action initially allows publishing only from the pipeline that created it. Other pipelines need the Read-write level in the artifact's Permissions tab.
Publishing a version is an artifact event, so it can start another pipeline, for example a test of the application with the new package version. The trigger configuration is described in On artifact event.
See also:
- Private Composer dependencies - private PHP dependencies in pipelines
- Permissions and access - Read-only, Read-write and Manage levels for pipelines
- npm registry - the same model for npm packages
- Host private Composer packages in Buddy - example with a Laravel package and a
/healthtest
Last modified on Dec 2, 2026