A lightweight command-line tool for managing local Composer package development using git-subrepo. Packager makes it easy to clone, pull, push, sync, and inspect PHP packages inside your project — all from a single unified workflow.
packages/
vendor/
package-a/
.gitrepo
package-b/
.gitrepo
Packager automatically configures Composer so these packages are loaded using a local path repository with symlinks enabled.
- Clone a Git repository directly into
packages/vendor/repo - Manage subrepositories via
git subrepo:clone,pull,push,syncpull-allandpush-allfor batch operations
- Auto-update
composer.jsonwith a localpathrepository definition - Doctor mode for verifying local packages and Composer configuration
- Zero dependencies outside standard tooling:
git,composer,git-subrepo
Build from source:
go build -o packager .
mv packager /usr/local/bin
Run anywhere inside a PHP project folder that contains a composer.json.
packager <command> [args]
| Command | Description |
|---|---|
clone <repo-url> |
Clone a package using git subrepo and require it in Composer |
pull <repo-url> |
Pull latest changes for a local subrepo |
push <repo-url> |
Push local changes back to the remote |
sync <repo-url> |
Pull + push in one command |
list |
List all cloned subrepositories |
pull-all |
Pull all subrepos in packages// |
push-all |
Push all subrepos in packages// |
fix-repositories |
Ensure composer.json contains a proper path repository |
doctor |
Inspect local packages and report missing/invalid configuration |
version |
Show Packager version |
help <command> |
Show detailed help for a single command |
When cloning a repository:
packager clone git@github.com:vendor/package.git
Packager will:
- Create:
packages/vendor/package/
- Run:
git subrepo clone git@github.com:vendor/package.git packages/vendor/package -b master
- Add the dependency to Composer:
composer require vendor/package:@dev
- Ensure a path repository exists in composer.json:
{
"repositories": [
{
"type": "path",
"url": "packages/*/*",
"options": {
"symlink": true
}
}
]
}
This allows Composer to load your local package directly from the filesystem while keeping symlinks intact for rapid development.
packager pull-all
packager push-all
Each valid subrepo under packages/*/* will be processed automatically.
Check for common issues:
packager doctor
Doctor verifies:
- presence of
.gitrepo - presence of
composer.json - whether the package is listed in the project’s require or require-dev
- consistency across the
packages/directory
Example output:
Packager doctor report
----------------------
[OK] vendor/package-a
.gitrepo: ok
composer.json: ok
in root deps: require
[WARN] vendor/experimental-lib
.gitrepo: missing
composer.json: ok
in root deps: none
Summary: 1 OK, 1 with warnings
- git
- git-subrepo https://github.com/ingydotnet/git-subrepo
- composer
- Go 1.20+ for building the binary
- Clone a package into your project:
packager clone git@github.com:vendor/my-lib.git
- Work on the package locally; changes stay inside your main project.
- Keep it synced:
packager pull my-lib
packager push my-lib
- Before committing or releasing:
packager doctor
- Synchronize all packages at once:
packager pull-all
packager push-all
PHP monorepos are often overkill and hard to maintain.
git subrepo provides a clean middle ground — but the workflow around it is repetitive.
Packager wraps the boilerplate with a predictable, developer-friendly interface and ensures Composer stays correctly configured for local development.