Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save komputronika/eb151e4fc4f4729e3fe1b602b2e25c09 to your computer and use it in GitHub Desktop.
Save komputronika/eb151e4fc4f4729e3fe1b602b2e25c09 to your computer and use it in GitHub Desktop.
Test an existing composer project (create-project) locally

First, clone the repository of the project :

  mkdir /tmp/project-name
  git clone ...

Create a packages.json file in the root, containing the following :

{
    "package": {
        "name": "vendor/project-name",
        "version": "1.0.0",
        "source": {
          "url": "/tmp/project-name/.git",
          "type": "git",
          "reference": "master"
        }
    }
}

Make your changes (and commit them), then test them locally :

composer create-project --repository-url=/tmp/project-name/packages.json vendor/project-name

To override some repositories with local copies (for testing commits/tags before you push them) you can add the following snippet in your composer.json (reference can be any branch):

    "repositories": [
        {
            "name": "kunstmaan/pagepart-bundle",
            "type": "git",
            "url": "/path/to/KunstmaanPagePartBundle/.git",
            "reference": "master"
        },
        {
            "name": "kunstmaan/utilities-bundle",
            "type": "git",
            "url": "/path/to/KunstmaanUtilitiesBundle/.git",
            "reference": "master"
        }
    ],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment