php-monorepo-builder
Skill2 starsChanged 7 months agoMITView on GitHub
Use `symplify/monorepo-builder` to manage PHP monorepos with `vendor/bin/monorepo-builder` and `monorepo-builder.php`. Trigger this skill when the user mentions monorepo-builder, merging package `composer.json` files into a root `composer.json`, validating inter-package versions, configuring package directories, propagating dependencies, or automating monorepo releases and release workers.
In this repository26 other files it gives its agents.
- other/AGENTS.mdAGENTS.md
- beamng-modsSkill
- bootstrap-vueSkill
- charmbraceletSkill
- depsdotdevSkill
- find-domainSkill
- github-cliSkill
- go-cobraSkill
- goreleaserSkill
- go-viperSkill
- kasettoSkill
- laravel-actionsSkill
- lefthookSkill
- miseSkill
- pelican-panel-pluginsSkill
- php-saloonSkill
- prd-todo-slicerSkill
- prd-to-kandev-tasksSkill
- qodo-mergeSkill
- release-pleaseSkill
- rewrite-in-goSkill
- shieldsioSkill
- skill-researcherSkill
- skill-scoutSkill
- taskfileSkill
- website-visual-testingSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 2 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Use this skill when you need to:
- Very specific: line 74
All configuration lives in monorepo-builder.php at the project root.
- Very specific: line 221
Run vendor/bin/monorepo-builder init to scaffold your monorepo.
- Very specific: line 222
Add packages under packages/ (each with its own composer.json).
- Very specific: line 223
Run vendor/bin/monorepo-builder merge to sync dependencies into root.
- Very specific: line 224
Check references/README.md for full configuration options.
- Very specific: line 229
Use dataToAppend to inject shared dev tooling (PHPStan, PHPUnit) into root composer.json.
- Very specific: line 230
Use dataToRemove to strip per-package-only entries (e.g.
- Very specific: line 231
Run validate in CI to catch inter-package version drift early.
- Very specific: line 232
Use propagate or bump-interdependency when root and package version constraints need to move together.
- Very specific: line 237
Use Option::REMOVE_COMPLETELY to drop entire sections (e.g.
- Distinctive: line 240
Use branch-aware tag validation if you maintain multiple active major version lines.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
monorepo-builder
A set of tools for managing PHP monorepos: merging composer.json files, validating package versions, releasing with automation, and more.
Repository: symplify/monorepo-builder
Package: monorepo-php/monorepo (via Packagist)
Language: PHP 8.2+
License: MIT License
Latest Release: 12.5.2 (2026-03-26)
When to Use This Skill
Use this skill when you need to:
- Set up a new PHP monorepo — scaffolding directory structure, initial
monorepo-builder.phpconfig - Merge
composer.jsonfiles — aggregate dependencies from all packages into the rootcomposer.json - Validate version consistency — ensure all inter-package dependencies use matching version constraints
- Automate releases — bump versions, tag releases, push tags across all packages in one command
- Manage package discovery — configure which directories are scanned for packages, and which to exclude
- Append or remove data after merge — add shared dev dependencies, remove per-package-only entries
- Troubleshoot merge issues — composer section ordering, dropped custom keys,
readmeproperty loss (fixed in 12.5.0) - Configure release workers — customize the sequence of steps that run during a release
Quick Reference
Installation
composer require monorepo-php/monorepo --devRequires PHP 8.2+. For PHP 8.1, use symplify/monorepo-builder:^11.2 (no longer maintained).
Initialize a New Monorepo
vendor/bin/monorepo-builder initGenerates a basic monorepo structure and a starter monorepo-builder.php config at your project root.
Core Commands
| Command | Description |
vendor/bin/monorepo-builder merge | Merge all package composer.json into root |
vendor/bin/monorepo-builder validate | Check that inter-package versions are consistent |
vendor/bin/monorepo-builder propagate | Push root dependency versions back into package composer.json files |
vendor/bin/monorepo-builder bump-interdependency <version> | Update mutual package constraints to one target version |
vendor/bin/monorepo-builder package-alias | Update branch-alias across package composer.json files |
vendor/bin/monorepo-builder localize-composer-paths | Swap mutual package paths to local paths for pre-split testing |
vendor/bin/monorepo-builder release <version> | Tag and release a new version across all packages |
vendor/bin/monorepo-builder init | Scaffold a new monorepo structure |
Configuration: Package Directories
All configuration lives in monorepo-builder.php at the project root.
use Symplify\MonorepoBuilder\Config\MBConfig;
return static function (MBConfig $mbConfig): void {
// Scan multiple directories for packages
$mbConfig->packageDirectories([
__DIR__ . '/packages',
__DIR__ . '/projects',
]);
// Exclude specific packages from discovery
$mbConfig->packageDirectoriesExcludes([
__DIR__ . '/packages/secret-package',
]);
};Configuration: Merge — Append and Remove Data
use Symplify\MonorepoBuilder\ComposerJsonManipulator\ValueObject\ComposerJsonSection;
use Symplify\MonorepoBuilder\Config\MBConfig;
use Symplify\MonorepoBuilder\ValueObject\Option;
return static function (MBConfig $mbConfig): void {
// Add data to root composer.json after merge
$mbConfig->dataToAppend([
ComposerJsonSection::AUTOLOAD_DEV => [
'psr-4' => [
'Symplify\Tests\\' => 'tests',
],
],
ComposerJsonSection::REQUIRE_DEV => [
'phpstan/phpstan' => '^2.1',
],
]);
// Remove data from root composer.json after merge
$mbConfig->dataToRemove([
ComposerJsonSection::REQUIRE => [
// Version is irrelevant — removed by key
'phpunit/phpunit' => '*',
],
ComposerJsonSection::REPOSITORIES => [
Option::REMOVE_COMPLETELY,
],
]);
};Note (12.5.0+):
dataToAppendnow supports arbitrary composer.json keys — no longer limited to 24 hardcoded sections.
Run a Merge
vendor/bin/monorepo-builder mergeReads all composer.json files in discovered package directories and merges their dependencies into the root composer.json.
Release a New Version
vendor/bin/monorepo-builder release 1.2.0Runs all configured release workers in sequence (bump versions, create tags, push, etc.).
Split Packages to Separate Repositories
Monorepo Builder does not handle package splitting itself. For split repos, pair it with symplify/github-action-monorepo-split in GitHub Actions.
Key Concepts
Package Discovery
By default, monorepo-builder scans ./packages for subdirectories containing a composer.json. You configure additional or alternative directories with packageDirectories(). Packages whose directory names contain tests may be excluded — see issue #59.
Merge Behaviour
The merge command aggregates require, require-dev, autoload, autoload-dev, and other sections from all discovered packages into the root composer.json. Since 12.5.0, custom/non-standard keys (e.g. scripts-aliases, abandoned, readme) are preserved during merge.
Release Workers
Release workers are discrete steps executed in sequence during a release. They can be customized or reordered. A known issue (#77) exists where SetNextMutualDependenciesReleaseWorker always increments the minor version — review worker ordering carefully.
Version Validation
The validate command checks that when package A depends on package B (both in the monorepo), the version constraint in A's composer.json matches the actual version of B. This prevents inter-package version drift.
Known Issues
Open Issues
| # | Summary |
| #90 | [Feature] Conventional Commit release support |
| #77 | SetNextMutualDependenciesReleaseWorker always updates minor version |
| #76 | No helper to import autoloader regardless of monorepo depth |
| #72 | Incompatible declaration in EventDispatcher.php |
| #69 | Composer install behaviour question |
| #59 | Packages with tests in name are always ignored |
| #25 | Interdependency version update fails for pre-release versions |
Recently Fixed (12.5.0 — 2026-02-13)
- Merge now preserves unknown/custom composer.json sections —
scripts-aliases,abandoned,readme, and any non-standard keys are no longer dropped (#105, #106, #71, #107) dataToAppendsupports arbitrary composer.json keys — no longer limited to 24 hardcoded sections (#105)
Recent Releases
| Version | Date | Highlights |
| 12.5.2 | 2026-03-26 | Allow sebastian/diff ^8 (#110) |
| 12.5.0 | 2026-02-13 | Preserve custom composer.json sections; arbitrary dataToAppend keys |
See references/releases.md for full release notes.
Reference Files
| File | Contents | Confidence |
references/README.md | Full README: install, commands, configuration options, usage examples | Medium |
references/releases.md | Release notes for all tagged versions (2 releases) | Medium |
references/issues.md | All 34 GitHub issues — 7 open, 27 closed — with labels and dates | Medium |
references/file_structure.md | Repository directory tree (813 items) | Medium |
Working with This Skill
Beginner
- Run
vendor/bin/monorepo-builder initto scaffold your monorepo. - Add packages under
packages/(each with its owncomposer.json). - Run
vendor/bin/monorepo-builder mergeto sync dependencies into root. - Check
references/README.mdfor full configuration options.
Intermediate
- Customize
monorepo-builder.phpto add multiple package directories and exclusions. - Use
dataToAppendto inject shared dev tooling (PHPStan, PHPUnit) into rootcomposer.json. - Use
dataToRemoveto strip per-package-only entries (e.g. local repositories) from the merged root. - Run
validatein CI to catch inter-package version drift early. - Use
propagateorbump-interdependencywhen root and package version constraints need to move together.
Advanced
- Configure and reorder release workers for custom release pipelines.
- Use
Option::REMOVE_COMPLETELYto drop entire sections (e.g.repositories) after merge. - Be aware of issue #77 when using
SetNextMutualDependenciesReleaseWorker— it may bump the minor version unexpectedly. - For pre-release versions (alpha/beta/RC), see issue #25 before relying on automatic interdependency updates.
- Use branch-aware tag validation if you maintain multiple active major version lines.
Source: GitHub repository symplify/monorepo-builder | Last updated: 2026-04-11
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

