Skip to content

mediaboutique/packager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

📦 Packager - A bare bones workbench for local package development

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.

Features

  • Clone a Git repository directly into packages/vendor/repo
  • Manage subrepositories via git subrepo:
    • clone, pull, push, sync
    • pull-all and push-all for batch operations
  • Auto-update composer.json with a local path repository definition
  • Doctor mode for verifying local packages and Composer configuration
  • Zero dependencies outside standard tooling: git, composer, git-subrepo

Installation

Build from source:

go build -o packager .
mv packager /usr/local/bin

Run anywhere inside a PHP project folder that contains a composer.json.

Usage

packager <command> [args]

Commands

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

How It Works

1. Local package structure

When cloning a repository:

packager clone git@github.com:vendor/package.git

Packager will:

  1. Create:

packages/vendor/package/

  1. Run:

git subrepo clone git@github.com:vendor/package.git packages/vendor/package -b master

  1. Add the dependency to Composer:

composer require vendor/package:@dev

  1. 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.

Batch Operations

Pull all packages

packager pull-all

Push all packages

packager push-all

Each valid subrepo under packages/*/* will be processed automatically.

Doctor Mode

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

Requirements

Recommended Workflow

  1. Clone a package into your project:
packager clone git@github.com:vendor/my-lib.git
  1. Work on the package locally; changes stay inside your main project.
  2. Keep it synced:
packager pull my-lib
packager push my-lib
  1. Before committing or releasing:
packager doctor
  1. Synchronize all packages at once:
packager pull-all
packager push-all

Why Packager Exists

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.

About

A bare bones workbench for local package development

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages