Determining Marketplace Package Names

With Magento Marketplace, you can purchase extensions and have them added to your personal Magento Marketplace Composer repository, hosted at https://repo.magento.com. Using this repository you can access all Composer packages you have permission to access. This includes all CE packages, possibly EE packages (if you have a license), and any specific extensions you have purchased.

Currently however the Marketplace does not display the package names of purchases (this may change in the future). This means if you are a developer and make a purchase and want to add that entry into your composer.json file in the require section by hand, you have to work out the package name (and version number) to use. This blog post introduces a little script I knocked up to help with identifying the correct package name to use.

The script can be found in a GIST at https://gist.github.com/alankent/aeacf82f86627dd96aa4df242493103f. It looks for an auth.json file, reads it to get the user’s repository keys, then fetches the packages.json file from the repository. The script then extracts some information from this file and displays it. In particular, the script ignores modules provided by Magento to keep the output volume down.

For each package, the script prints out the package name and package type on the first line (the package name here is what you will add to your composer.json file in the require section). The following lines list all versions of the package, along with dependencies that package has on other packages. This can be useful to check version compatibility.

Finally the description of the module (if available) is displayed.

Coming back to the package type displayed on the first line, typically a purchase from the Marketplace will be one of the following:

  • magento2-theme
  • magento2-module (Magento provided modules are not displayed by the tool)
  • metapackage

It is unlikely your project’s composer.json file will ever depend something other than the above three package types.

If an extension is implemented as a set of two or more modules, then Magento requires that a metapackage be created that references the modules in the extension. Thus the composer.json file would depend on that the metapackage package. If the extension has a single package, the composer.json file would depend directly on that single package.

The following is sample output of the script. The first package is the skeletal product package, used to kick start a new project.

magento/project-community-edition [project]
    2.0.0 magento/product-community-edition:2.0.0
    2.0.1 magento/product-community-edition:2.0.1
    2.0.2 magento/product-community-edition:2.0.2
    2.0.3 magento/product-community-edition:2.0.3
    2.0.4 magento/product-community-edition:2.0.4
    2.0.5 magento/product-community-edition:2.0.5
    eCommerce Platform for Growth (Community Edition)

Next comes the blank theme. Note that a version compatible with the Magento beta program is still made available.

magento/theme-doc-blank [magento2-theme]
    0.74.0-beta4 magento/framework:0.1.0
    100.0.2 magento/framework:0.1.0
    N/A

And then the DotMailer extension comes next which I “purchased”earlier. (The module is actually free, but you must go through the normal purchase flow for it to be reigstered before I return.) Note that it is a “magento2-module”, so there is not metapackage to depend on. Looking at the requirements information you can see there is only version 1.1 released, and it depends on 100.0.* of core Magento. This means this module will need repackaging for 2.1 as only the 2.0 version number dependencies are listed.

dotmailer/dotmailer-magento2-extension [magento2-module]
    1.1.0 magento/framework:100.0.*
    dotmailer integration for magento 2

Another example package, Pixlee. Again no dependencies are declare as included. without dependencies listed (which may be a mistake as it does not sense to not specify the compatible version numbers in this file), it is harder to analyze such cross dependencies on packagist.

pixlee/magento2 [magento2-module]
    1.0.0
    Social commerce platform to collect, curate, and display user-generated
    content to enhance your Magento store

So in summary, if you enjoy using command line tools, the GIST above will display the real package names to be included in files. If in doubt, go for metapackages first.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.