SyntaxStudy
Sign Up
PHP Advanced 4 min read

Monorepo with Composer

Monorepo Setup

A monorepo hosts multiple packages in one repository. Use path repositories and symlinks for local development.

Example
// Root composer.json
"repositories": [
  { "type": "path", "url": "packages/auth",    "options": { "symlink": true } },
  { "type": "path", "url": "packages/billing", "options": { "symlink": true } }
],
"require": {
  "myapp/auth":    "*",
  "myapp/billing": "*"
}
// packages/auth/composer.json: { "name": "myapp/auth" }
Pro Tip

Path repositories with symlink: true mean local changes are immediately visible without reinstall.