0

What would be the steps and the proper way to call a 3rd party module that you cannot load via composer? Is there a acceptable method for doing this in Magento 2?

I am looking at implementing a 3rd party library into a store but the library is not open source or available on packagist.org.

2

You have different possibilities to work with composer package even if they are not in public repository like packagist.

1) Possibility

Own Composer Repository, you can achieve this with Satis or Private Packagist or Toran Proxy.

2) Possibility

Artifact, In this case you don't need have a online repository. Is a compressed folder with your private packages. E.g:

{
    "repositories": [
        {
            "type": "artifact",
            "url": "path/to/directory/with/zips/"
        }
    ],
    "require": {
        "private-vendor-one/core": "15.6.2",
        "private-vendor-two/connectivity": "*",
    }
}

3) Possibility

Path You can specify a path (relative or absolute) of your composer repo in host. E.g:

{
    "repositories": [
        {
            "type": "path",
            "url": "../../packages/my-package"
        }
    ],
    "require": {
        "private-vendor/package": "*"
    }
}

With these possibilities you don't need deal with others solutions IMHO.

You have more info about composer repos here

  • Thank you for the suggestion. I am aware of private repositories. However, the usage rights to the library expressly prohibit the posting of the code to 3rd parties including private repositories. – Eirik May 23 '17 at 2:42
  • I missed your comment about an artifact, I'll test this seems like it will suit my needs. Thank you – Eirik May 23 '17 at 2:43
  • You can try with @Rafael solution or with Path or Artifact, maybe is the better approach for you. If you feel comfartable with solution please upvote the answer :) – osrecio May 23 '17 at 8:38
  • Artifacts where the way to go. I appreciate the explanation. – Eirik May 23 '17 at 13:49
  • Will this automatically integrate library if the composer.json is placed at module's root without composer update command during module installation? – Vivek Kumar May 10 '18 at 12:16
1

This solution allows you to work with your private repositories at GitHub and BitBucket.

The branch used is the master, if you want to use the develop for example use dev-develop instead of dev-master.

{
    "require": {
        "vendor/my-private-repo": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@bitbucket.org:vendor/my-private-repo.git"
        }
    ]
}

The only requirement is the installation of SSH keys for a git client.

  • Thank you for the suggestion. I am aware of private repositories. However, the usage rights to the library expressly prohibit posting of the code to 3rd parties including private repositories. I believe what I am going to end up doing is setting the server path to a /lib folder inside my module and then using the directoryList model to retrieve it. – Eirik May 23 '17 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.