bkief29/pcomposer

A composer plugin to provide the ability to share and reuse packages across the system.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Type:composer-plugin

1.0 2022-05-17 18:53 UTC

This package is auto-updated.

Last update: 2024-10-29 05:54:13 UTC


README

Based on the ideology of pnpm to reduce and reuse shared packages.

Install

composer global require bkief29/pcomposer

Setup

Modify your ~/.composer/config.json to include the following:

Replace %MY_USER% with your user, or specify a custom path for vendor-dir

{
    "config": {
        "allow-plugins": {
            "bkief29/pcomposer": true
        },
        "extra" : {
            "shared-package": {
                "vendor-dir": "/Users/%MY_USER%/.composer/pcomposer",
                "symlink-dir": "vendor",
                "symlink-enabled": true,
                "package-list": [
                    "*"
                ]
            }
        
        }
    }
}

Options

Exclude packages from being symlinked

In your project's composer.json:

"config": {
    "extra" : {
        "pcomposer": {
            "exclude": [
                "spatie/data-transfer-object"
            ]
        }
    }
},

Extras

Migrate to pcomposer for all of your projects

Usage: pcomposer ~/projects

function pcomposer() {
  find $1 -type d \( -name "vendor" \) -maxdepth 2 -print0 | while read -d $'\0' file
  do
     echo "$file"
     cd "$file/../" && composer install
  done
}