Plugin: updater-composer
Updates the version field in composer.json for PHP projects when explicitly opted in. Because Composer 2.x typically derives package versions from Git tags, this plugin leaves composer.json untouched by default unless update_version_field: "true" is configured.
Installation
Section titled “Installation”Binary
Section titled “Binary”semrel plugin install @semrel/updater-composersemrel plugin install downloads the binary to .semrel/plugins/ and updates .semrel.lock. Commit .semrel.lock to pin the version for your team.
Docker
Section titled “Docker”Pre-built, signed multi-platform images (linux/amd64, linux/arm64) are published on every release:
docker pull ghcr.io/semrels/updater-composer:latestVerify the image signature with cosign:
cosign verify ghcr.io/semrels/updater-composer:latest \ --certificate-identity-regexp 'https://github.com/SemRels/updater-composer/.github/workflows/release.yml.*' \ --certificate-oidc-issuer https://token.actions.githubusercontent.comConfiguration
Section titled “Configuration”version: 1plugins: - uses: @semrel/updater-composer phase: pre-tag args: file: composer.json update_version_field: "true"Environment Variables
Section titled “Environment Variables”| Name | Required | Default | Description |
|---|---|---|---|
SEMREL_PLUGIN_FILE | no | composer.json | Path to the Composer manifest to update. |
SEMREL_PLUGIN_COMPOSER_FILE | no | — | Alias for SEMREL_PLUGIN_FILE when a Composer-specific variable name is preferred. |
SEMREL_PLUGIN_UPDATE_VERSION_FIELD | no | false | When true, updates or inserts the version field in composer.json. |
Release Context Variables
Section titled “Release Context Variables”SEMREL_VERSIONSEMREL_NEXT_VERSIONSEMREL_DRY_RUN
Behavior
Section titled “Behavior”By default the plugin is a safe no-op and logs why it did not modify composer.json. When SEMREL_PLUGIN_UPDATE_VERSION_FIELD=true, it strips any leading v from the release version, writes the bare SemVer string to composer.json, and preserves existing key ordering and formatting.