Magento 2 Marketplace Upload Validation Tool (Quick Note)

Magento Marketplace is going through beta testing before opening up more widely. One area that has become clear is the need for a tool to help with verifying the packaging of extensions before submission. This blog post is a preview into this tool so extension developers can try it out today and provide feedback.

In doing submission walk-throughs with a number of application developers, a common source of friction was getting the ZIP upload “just right”. There is the composer.json file, the overall structure of the ZIP file, etc. Because Composer is a new approach for Magento and it was the first time for many extension developers building a Composer ZIP, there were a few repeating problems that came up. The issues were simple to fix, but wasted time during the submission process. So, we are making a tool available that extension developers can use to detect common problems before they attempt to submit. We are making a beta of this script available now to collect feedback before official release.

The script is currently available as a GIST. [Update Feb 19: V2 now available here.]  (This may be taken down in the future when the official release is made.) The current version is a standalone PHP script that takes the Composer package ZIP file(s) on the command line. Errors are reported to the screen. Examples include a missing composer.json file, missing fields in the composer.json file, and so on.

$ php validate_m2_package.php

Please leave any issues you encounter in the comments section below. Examples of problems include false positives (reported errors that are not really errors) and false negatives (missed problems).



  1. Can’t we have support for sub-directories? Like most of composer libraries have their code place inside a “src/” folder.

  2. The tool seems to be more prescribed than what Magento is able to support (and by extension the marketplace). Zipping this extension up seems to be unacceptable to the script even though it works as far as Magento itself is concerned. For example:

    composer config repositories.fm0017 vcs
    composer require fooman/sameorderinvoicenumber-m2
    bin/magento module:enable Fooman_SameOrderInvoiceNumber

    The extension code would then be installed under ./vendor/fooman/sameorderinvoicenumber-m2.

  3. Hi Alan, there are any plan to release also a phpcs ruleset for static code validation? For example like the old

  4. J Ravi Menon · · Reply

    Rafael, Kristof,

    Thanks for the feedback.

    We are currently reviewing support for the ‘src/‘ approach too.

    The current version of the tool supports the layout structure as documented here:


  5. I have uploaded a quickly modified version of the tool which reads the json to work out file locations here Let me know if you have examples for further testing and I’ll take a look. It currently sounds like the tool would be the only reason why Marketplace doesn’t “support” this approach.

  6. Just stumbled over this related issue whereby the component manager makes an assumption that registration.php and composer.json reside in the same folder. Duplicating the composer.json can be used as a workaround but I think this can be solved better.

  7. For anyone else who comes across this blog, this tool has been officially published here:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: