Skip to content

Instantly share code, notes, and snippets.

@rstriquer
Created April 19, 2023 19:23
Show Gist options
  • Save rstriquer/541cf089ce51d3bcb9125af50ff68160 to your computer and use it in GitHub Desktop.
Save rstriquer/541cf089ce51d3bcb9125af50ff68160 to your computer and use it in GitHub Desktop.
How to try a composer package hosted on a specific branch/tag version on a remote git repository

Let's consider we want to try the v1.0.0-rc2 on our package rstriquer/eloquent-logger hosted on github.

First you got to add the repository definition at your project's composer.json file:

  "repositories": [
    {
      "type":"package",
      "package": {
        "name": "rstriquer/eloquent-logger",
        "version":"v1.0.0-rc2",
        "source": {
          "url": "https://github.com/rstriquer/eloquent-logger.git",
          "type": "git",
          "reference":"main"
        }
      }
    }
  ]

Thenk you add the "rstriquer/eloquent-logger": "v1.0.0-rc2" item in the require json part you intent to. In this case this package shoud be installed on the dev environment only therefore we add it at the require-dev json item.

  "require-dev": {
    "other/sample-pack": "whatever-version-sample",
    "rstriquer/eloquent-logger": "v1.0.0-rc2"
  }

The same goes for if you want to test a branch. Just change the the TAG name both on repositories and on require-dev to the name of the branch you want to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment