Tegami

Composer

PHP Composer workspace support and Packagist tagging.

The Composer plugin discovers PHP packages from composer.json, bumps versions, updates workspace constraints, and publishes through git tags that Packagist reads.

npm install @tegami/composer
import { tegami } from "tegami";
import { git } from "tegami/plugins/git";
import { composer } from "@tegami/composer";

const paper = tegami({
  plugins: [git(), composer()],
});

Requirements

Composer packages publish through git tags, so the Composer plugin requires the git plugin. The GitHub and GitLab plugins include git() already.

Discovery

Tegami reads the root composer.json and collects members from:

  • repositories entries with "type": "path"
  • the packages option, for layouts that do not use path repositories

The root itself is included when it declares a name. Each package needs a name in vendor/package form.

How Composer versioning works

Composer packages usually have no version field. Packagist derives versions from git tags, and Tegami follows that:

  • Current version comes from existing git tags (v1.0.0 at the root, packages/api/v1.0.0 for a subdirectory package). An explicit version in composer.json is used as a fallback when present.
  • Next version is stored in the publish lock during tegami version.
  • Publishing creates git tags through the git plugin.

Dependency bumping

Dependency fieldDefault dependent bump
requirepatch
require-devnone

When a released version no longer satisfies a dependent's constraint, Tegami rewrites it while keeping the same operator style (~1.2 becomes ~2.0).

Configuration

composer({
  tagPrefix: "v",
  updateLockFile: false,
  bumpDep: ({ field }) => (field === "require" ? "patch" : false),
});

Prop

Type

Set updateLockFile: true to run composer update --lock after versioning (requires PHP and Composer).

Publishing

Publishing creates a git tag per package ({tagPrefix}{version} at the repo root, {relativeDir}/{tagPrefix}{version} for subdirectory packages).

Monorepos and Packagist

Public Packagist indexes one package per repository. A monorepo package will not appear on packagist.org from a shared repo. Use repository splitting or a private registry such as Private Packagist or Satis. Tegami still manages versions, constraints, and tags either way.

Registry verification is off by default (verifyRegistry: false) because monorepo packages may never appear on the public registry. Publish status then relies on the git plugin's tag check.

On this page