Grayscale profile picture

Patrique Ouimet

Developer

PHP Composer Package Testing

Thu, Apr 23, 2020 6:38 AM

When you're making changes to a package and want to test it in another project there's a few options.

Remote Branch and Commit

This first option is referencing a branch and possibly a commit.

{
  "repositories": [
    {
      "type": "git",
      "url": "git@github.com:patoui/my-package.git"
    }
  ],
  "require": {
    "patoui/my-package": "dev-big-update"
  }
}

In this example we're loading a package from patoui/my-package git repository, and the important part is dev-big-update. The big-update portion represents the branch being referenced on the remote.

Local Path/Directory

{
  "repositories": [
    {
      "type": "path",
      "url": "/var/www/my-package"
    }
  ],
  "require": {
    "patoui/my-package": "dev-master"
  }
}

Here we're referencing a package found at /var/www/my-package and specifically the master branch as defined by dev-master